ps, pstree, and top (with grep) — to examine process activity as snapshots and in real time. These tools are essential for troubleshooting CPU and memory usage, identifying runaway processes, and understanding parent/child relationships between processes.

Quick reference — when to use which tool
See References at the end for man pages and further reading.
Inspect a snapshot with ps
ps prints a static snapshot of processes at the moment it runs. Two common output styles are BSD-style and System-V style.
BSD-style (includes CPU and memory columns):
Common ps use cases and options
To output specific fields for a PID:
Filter ps output with grep
Search the ps output for a process such assshd:
ps gives a static snapshot of processes at the time it runs. When you need continuous, real-time monitoring of CPU, memory and process activity use top (or interactive tools like htop and glances).View parent/child relationships with pstree
pstree prints a tree showing which processes spawned which children — useful for understanding process hierarchies:
Live monitoring with top
top provides an interactive, continuously updating view of system load and a sorted list of processes.
Example top header and a few processes (truncated):
Useful interactive keys in top
Examples:
- Press
cwhiletopis running to toggle full command lines. - Press
Mto immediately reorder by memory usage. - Use
fthen Space to toggle columns, Enter to apply, andWto save the layout.
Summary
- Use
psfor a point-in-time snapshot and custom, scriptable output. - Use
pstreeto visualize parent/child relationships. - Use
topfor an interactive live view with sorting and field selection. - Combine
pswithgrepto filter results andps --sortto identify top consumers of CPU or memory.
Links and References
- ps(1) manual - Linux man-pages project
- top(1) manual - Linux man-pages project
- pstree(1) — Linux command reference
- htop — interactive process viewer (alternative to top)