The ps command
report a snapshot of the current processes. 12 examples from the lessons of the IVski Linux Playground — try them in the terminal next to them.
Options in the examples
--sort spec- Specify sorting order. Sorting syntax is [+|-]key[,[+|-]key[,...]].
-e- Select all processes. Identical to -A.
-f- Do full-format listing. This option can be combined with many other UNIX-style options to add additional columns.
-H- Show process hierarchy (forest).
-j- Jobs format.
-u userlist- Select by effective user ID (EUID) or name.
Examples
ps aux | grep nginx
ps aux | grep nginx | wc -lCount nginx processes
psYour processes in current shell
ps auxALL processes, detailed
ps -efAll processes, full format
ps -u studentProcesses for user 'student'
ps aux | grep -v grep | grep python
ps -ejHHierarchical
ps aux --sort=-%cpu | head -4The header and the 3 busiest processes
ps aux --sort=-%cpu | headTop CPU-consuming processes
ps aux | grep -v grep | grep <name>
ps aux | grep traceThe process behind it
Lessons that use ps
- grep — Searching Text
- Pipes & Redirection
- ps — Listing Processes
- nginx — Your First Web Server
- Project: Server Health Check
- Mission: Service Down
- Mission: Security Sweep
- Mission: Deleted, But Still Full
- Mission: 403 Forbidden