top and htop: watch processes live

Updated November 2026

top shows a live, updating list of the processes using the most CPU, together with the system's load, memory and swap. It is the first tool to open when a server is slow.

top [-d seconds] [-u user] [-p pid]

Reading the header

top - 09:21:07 up 3 days, 14:02,  2 users,  load average: 3.12, 2.40, 1.95
Tasks: 214 total,   2 running, 212 sleeping,   0 stopped,   0 zombie
%Cpu(s): 41.2 us,  6.3 sy,  0.0 ni, 47.9 id,  4.1 wa,  0.0 hi,  0.5 si,  0.0 st
MiB Mem :  15890.4 total,    812.6 free,   9103.2 used,   6382.7 buff/cache
MiB Swap:   2048.0 total,   2040.1 free,      7.9 used.   6787.2 avail Mem

Keys inside top

KeyAction
P / M / TSort by CPU / memory / running time
1Show each CPU separately
cShow full command lines
uOnly one user's processes
oFilter, for example COMMAND=php
kKill a process (asks for PID and signal)
HShow threads
WSave the current view as your default
qQuit

Examples

top                          # interactive
top -u www-data              # one user
top -p 950,951               # selected PIDs
top -b -n 1 | head -20       # one snapshot as text, for scripts or e-mails
top -b -n 1 -o %MEM | head -15   # snapshot sorted by memory (procps-ng)

htop and btop

htop is a friendlier top with colours, mouse support, a tree view (F5) and easy searching (F3) and killing (F9). btop adds graphs for CPU, memory, disks and network. Install them with your package manager.

Quick checks without top

uptime                 # load average
nproc                  # number of CPU cores
free -h                # memory and swap
vmstat 2 5             # CPU, memory, swap and I/O every 2 seconds, 5 times
iostat -xz 2           # disk utilisation and wait times (sysstat package)

On AIX use topas or nmon, on Solaris prstat, on HP-UX glance or top. To end a runaway process, see kill.