Real-time dynamic view of system processes, CPU, and memory usage.
low risk
top provides a live display sorted by CPU usage. Press M to sort by memory, k to kill a process, q to quit. -b runs batch mode for scripting.
| Flag | Meaning |
|---|---|
-b --batch | Non-interactive batch mode for scripts |
-n | Number of iterations before exiting |
-p | Monitor specific PIDs only |
-u | Show processes for a specific user |
top -bn1 | head -20Capture a single top snapshot for logging · explain & risk-check →top -u www-dataMonitor only web server user processes · explain & risk-check →Install `htop` — same as top but with color, mouse support, and a much cleaner UI: `sudo apt install htop`
Reference text is hand-written and may be incomplete — check man top for your version. Test destructive commands on a non-production system first.