ps
The ps (process status) command is one of the most commonly used utilities in Linux to view a snapshot of currently running processes. Unlike top, which provides a dynamic view, ps gives a static list of processes at the exact moment the command is executed.
Basic Syntax
ps [OPTIONS]
Common Flags/Options
The ps command supports several syntax styles (UNIX, BSD, and GNU). The most common combinations are UNIX/BSD style.
| Option | Description |
|---|---|
-e or A | Select all processes (every process on the system). |
-f | Do a full-format listing (shows UID, PID, PPID, C, STIME, TTY, TIME, CMD). |
a | Lift the BSD-style "only yourself" restriction (show processes for all users). |
u | Display user-oriented format (shows USER, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME, COMMAND). |
x | Show processes without a controlling terminal (daemons). |
-p PID | Show process information for a specific Process ID (PID). |
Real-world Examples
1. View all running processes (System V style)
This is a very common command combination used to see absolutely everything running on the system in a detailed format.
ps -ef
2. View all running processes (BSD style)
This combination is extremely popular for getting a comprehensive, user-oriented list of all processes.
ps aux
3. Find a specific process
You will frequently pipe the output of ps to grep to find a specific application.
ps aux | grep nginx
4. View processes for a specific user
If you want to see what processes the user alice is running:
ps -u alice
5. Display a process tree
You can visualize the parent-child relationships between processes using the --forest flag (or by using the pstree command separately).
ps -ejH --forest