ps flags & options

aux

Show all processes with user, CPU, and memory info. BSD-style (no dash).

ps aux
ps aux | grep nginx

-e, -A

Select all processes. POSIX-style.

ps -e

-f

Full format listing with UID, PID, PPID, start time, and command.

ps -ef
ps -ef | grep python

-p

Select process by PID.

ps -p 1234
ps -p 1234 -o pid,comm,%cpu,%mem

-u

Select by effective user.

ps -u www-data

-o

Custom output format. Specify which columns to show.

ps -eo pid,ppid,comm,%cpu,%mem --sort=-%cpu
ps -eo pid,comm,rss --sort=-rss | head -10

--sort

Sort output by a column. Prefix with - for descending.

ps aux --sort=-%mem
ps aux --sort=-%cpu | head -10

--forest

Show process tree with ASCII art.

ps -ef --forest

-C

Select by command name.

ps -C nginx
ps -C node -o pid,%cpu,comm