process

ps

Snapshots the current process list. Accepts both BSD-style and UNIX-style flags depending on how you want to slice the output.

ps [OPTIONS]

Common flags

Flag Purpose
-e Select every process
-f Full-format listing (UID, PID, PPID, CMD, etc.)
aux BSD-style: all users, with owner and TTY
-o Custom output columns (e.g. -o pid,rss,cmd)
--sort Sort by one or more columns (prefix - for descending)
-p Show only the given PID(s)

Examples

ps aux

Classic view of every running process

ps -ef | grep nginx

Find nginx processes with full command lines

ps -eo pid,rss,cmd --sort=-rss | head

Top 10 memory consumers

ps -p 1234 -o etime=

Report the elapsed time of a single PID

Gotcha

ps aux (BSD) and ps -ef (UNIX) both work on Linux but produce different columns -- pick the flavor your script parses consistently.

Related commands

← All Linux commands · Linux cheat sheet