Skip to content

htop - Interactive Process Viewer Cheatsheet

htop - Interactive Process Viewer Cheatsheet

htop is an interactive process viewer and system monitor for Linux, macOS, and BSD. It improves on the classic top with a scrollable, colorized, mouse-aware interface, per-core meters, a process tree, text filtering, and one-keystroke signal sending — no need to memorize PIDs.

Installation

PlatformCommand
Ubuntu/Debiansudo apt install htop
Fedora/RHELsudo dnf install htop
Arch Linuxsudo pacman -S htop
openSUSEsudo zypper install htop
Alpinesudo apk add htop
macOS (Homebrew)brew install htop
FreeBSDsudo pkg install htop

Launching htop

CommandDescription
htopStart htop
htop -u USERShow only processes owned by USER
htop -p PID1,PID2Monitor only the listed PIDs
htop -d 10Set update delay (tenths of a second; 10 = 1s)
htop -s PERCENT_CPUStart sorted by a column (e.g. PERCENT_MEM, TIME)
htop -tStart in tree view
htop -CMonochrome / no-color mode
htop --readonlyDisable all process-altering keys (safe demos)
htop -hHelp and full flag list
htop -VVersion

Essential Keys

KeyAction
F1 / hHelp
F2 / SSetup (meters, colors, columns, display options)
F3 / /Incremental search by process name
F4 / \Filter: show only matching processes
F5 / tToggle tree view
F6 / >Choose the sort column
F7 / ]Increase priority (lower nice — needs root)
F8 / [Decrease priority (raise nice)
F9 / kSend a signal to the selected process (kill menu)
F10 / qQuit

Selecting and Acting on Processes

KeyAction
SpaceTag/untag a process (act on many at once)
UUntag all processes
cTag process and its children
kOpen the signal menu (SIGTERM, SIGKILL, SIGHUP, …)
aSet CPU affinity for the process (where supported)
lList open files for the process (lsof)
sTrace syscalls with strace
eShow the process environment variables
iSet I/O scheduling priority (ionice)

Sorting and Display Toggles

KeyAction
PSort by CPU usage
MSort by memory usage
TSort by accumulated CPU time
IInvert the current sort order
HShow/hide user threads
KShow/hide kernel threads
pShow/hide full program paths
FFollow the selected process as the list re-sorts
uFilter the list by a chosen user
+ / -Expand/collapse a subtree (in tree view)

Reading the Meters

ElementMeaning
CPU barsPer-core load; colors: blue = low-priority, green = normal/user, red = kernel/system, orange = IRQ
Mem bargreen = used, blue = buffers, yellow/orange = cache
Swap barred = used swap
Load average1/5/15-minute run-queue averages
PRI / NIKernel priority and nice value
VIRT / RES / SHRVirtual, resident, and shared memory
SProcess state: R running, S sleeping, D uninterruptible, Z zombie, T stopped

Configuration

htop saves settings (meters, columns, colors, sort) automatically on quit to:

~/.config/htop/htoprc

Edit it through the UI with F2 (Setup) rather than by hand — htop rewrites the file on exit. To experiment without touching your config:

htop --config /dev/null     # run with defaults, save nothing

Common Workflows

# Find and kill a runaway process by name
htop                # press / , type the name, press F9, choose SIGKILL

# Watch only one service and its workers
htop -p $(pgrep -d, nginx)

# Quietly demo on a shared box (no accidental kills)
htop --readonly

# One-second refresh, sorted by memory, in tree view
htop -d 10 -s PERCENT_MEM -t

htop vs top vs btop

Featuretophtopbtop
Scroll / mouseLimitedYesYes
Process treeLimitedYes (F5)Yes
Search & filterNoYes (F3/F4)Yes
One-key signalsNoYes (F9)Yes
GraphsNoBarsRich graphs
Resource footprintLowestLowHigher
AvailabilityUniversalVery wideNewer

Resources