ps (process status) prints a snapshot of processes. Unlike top or htop, it does not continuously refresh, which makes it particularly useful in shell pipelines, scripts, and one-time diagnostics.
Current Terminal Processes
ps
All Processes
ps -e
ps -ef
ps -ef uses a Unix-style full-format listing with fields such as UID, PID, PPID, and command.
Choose Columns Explicitly
ps -eo pid,ppid,user,cmd,%cpu,%mem
This is useful when you want stable, focused output for inspection or scripts.
Sort by CPU or Memory
ps -eo pid,ppid,cmd,%cpu --sort=-%cpu | head
ps -eo pid,ppid,cmd,%mem --sort=-%mem | head
The GNU/procps --sort option may not be available in exactly the same form on every Unix-like system.
Inspect a Specific PID
ps -p 1234 -o pid,ppid,user,etime,cmd
Process Trees
ps -e --forest
Or use pstree when installed:
pstree -p
Find a Process by Name
Instead of parsing ps output with grep, use pgrep when possible:
pgrep -a nginx
Conclusion
ps is ideal for process snapshots and scriptable diagnostics. Combine explicit output columns, sorting, and PID filters to answer a specific question rather than scanning an unstructured process dump.