Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH

Bash ps - Report a Snapshot of Current Processes

Using the ps Command

The ps command is used to report a snapshot of current processes.

It's a useful tool for monitoring and managing processes on your system.

All examples below use a hypothetical process list for demonstration:

PID TTY          TIME CMD
1234 pts/0    00:00:01 bash
5678 pts/1    00:00:02 python
9101 pts/2    00:00:03 node

Understanding the Output

The ps command output consists of several columns, each representing different aspects of the system's processes:

  • PID: Process ID, a unique identifier for each process.
  • TTY: Terminal type associated with the process.
  • TIME: Total CPU time used by the process.
  • CMD: The command that started the process.

Basic Usage

To display a snapshot of current processes, use ps:

Example: Basic Usage

ps
PID TTY          TIME CMD
1234 pts/0    00:00:01 bash
5678 pts/1    00:00:02 python
9101 pts/2    00:00:03 node

Options

The ps command has options to change how it works:

  • -e - Show all processes
  • -f - Show detailed information
  • -u - Show processes for a specific user
  • -a - Show all processes with a terminal
  • -x - Show processes without a terminal

Show All Processes

The -e option allows you to show all processes.

Example: Show All Processes

ps -e
PID TTY          TIME CMD
1234 pts/0    00:00:01 bash
5678 pts/1    00:00:02 python
9101 pts/2    00:00:03 node

Show Detailed Information

The -f option allows you to show detailed information.

Example: Show Detailed Information

ps -f
UID        PID  PPID  C STIME TTY          TIME CMD
user      1234     1  0 08:00 pts/0    00:00:01 bash
user      5678  1234  0 08:01 pts/1    00:00:02 python
user      9101  5678  0 08:02 pts/2    00:00:03 node

Show Processes for a Specific User

The -u option allows you to show processes for a specific user.

Example: Show Processes for a Specific User

ps -u user
PID TTY          TIME CMD
1234 pts/0    00:00:01 bash
5678 pts/1    00:00:02 python

Show Processes with a Terminal

The -a option allows you to show all processes with a terminal.

Example: Show Processes with a Terminal

ps -a
PID TTY          TIME CMD
1234 pts/0    00:00:01 bash
5678 pts/1    00:00:02 python

Show Processes without a Terminal

The -x option allows you to show processes without a terminal.

Example: Show Processes without a Terminal

ps -x
PID TTY          TIME CMD
9101 ?        00:00:03 node

Combining Options

Options can be combined to provide more detailed output. For example, ps -ef shows all processes with detailed information.

Example: Combine Options

ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
user      1234     1  0 08:00 pts/0    00:00:01 bash
user      5678  1234  0 08:01 pts/1    00:00:02 python
user      9101  5678  0 08:02 pts/2    00:00:03 node


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.