ps
Quick Reference
Command Name:
ps
Category:
process management
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
- 1
Process monitoring
Display information about running processes
- 2
Resource usage
Monitor CPU, memory, and I/O usage of processes
- 3
Troubleshooting
Diagnose issues with running processes
- 4
Scripting
Use in shell scripts to monitor and manage processes
Syntax
ps [options]
Options
Option | Description |
---|---|
-e, -A | Select all processes |
-a | Select all processes except session leaders and processes not associated with a terminal |
-f | Full format listing (UID, PID, PPID, etc.) |
-l | Long format |
-u username | Display processes for a specific user |
-p pid | Select by process ID |
-C command | Select by command name |
--sort=spec | Sort output (e.g., --sort=-%cpu for CPU usage, highest first) |
-o format, -o field1,field2 | User-defined format or specific fields |
-H | Show process hierarchy (tree) |
a | Show processes of all users (BSD style) |
u | Display in user-oriented format (BSD style) |
x | Include processes without controlling terminals (BSD style) |
j | Jobs format |
w | Wide output (don't truncate command lines) |
Examples
How to Use These Examples
The examples below show common ways to use the ps
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Usage:
ps
Show processes for the current shell with minimal information (PID, TTY, TIME, and CMD).
ps -ef
Display all processes in full format (standard Unix style).
ps aux
Show all processes for all users with detailed information (BSD style).
Filtering Processes:
ps -u username
Display processes for a specific user.
ps -C firefox
Find processes by command name.
ps -p 1234
Show information for a specific process ID.