process

top

Interactive real-time view of processes and system resource usage. Refreshes on an interval and supports live sorting and filtering.

top [OPTIONS]

Common flags

Flag Purpose
-b Batch mode -- output plain text, useful for scripts
-n Exit after N refresh iterations
-d Refresh delay in seconds
-p Monitor only the specified PID(s)
-u Show only processes for the given user
-H Show individual threads

Examples

top

Launch the interactive dashboard

top -b -n 1 > snapshot.txt

Capture a single top snapshot for later review

top -u www-data

Monitor only the web-server user

top -p $(pgrep -d, nginx)

Watch only nginx PIDs

Gotcha

Inside the interactive view, press h for help; press P to sort by CPU or M by memory -- sorting flags on the command line are limited.

Related commands

← All Linux commands · Linux cheat sheet