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 -l

Count nginx processes

ps

Your processes in current shell

ps aux

ALL processes, detailed

ps -ef

All processes, full format

ps -u student

Processes for user 'student'

ps aux | grep -v grep | grep python
ps -ejH

Hierarchical

ps aux --sort=-%cpu | head -4

The header and the 3 busiest processes

ps aux --sort=-%cpu | head

Top CPU-consuming processes

ps aux | grep -v grep | grep <name>
ps aux | grep trace

The process behind it

Lessons that use ps

Related commands