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
| Platform | Command |
|---|
| Ubuntu/Debian | sudo apt install htop |
| Fedora/RHEL | sudo dnf install htop |
| Arch Linux | sudo pacman -S htop |
| openSUSE | sudo zypper install htop |
| Alpine | sudo apk add htop |
| macOS (Homebrew) | brew install htop |
| FreeBSD | sudo pkg install htop |
Launching htop
| Command | Description |
|---|
htop | Start htop |
htop -u USER | Show only processes owned by USER |
htop -p PID1,PID2 | Monitor only the listed PIDs |
htop -d 10 | Set update delay (tenths of a second; 10 = 1s) |
htop -s PERCENT_CPU | Start sorted by a column (e.g. PERCENT_MEM, TIME) |
htop -t | Start in tree view |
htop -C | Monochrome / no-color mode |
htop --readonly | Disable all process-altering keys (safe demos) |
htop -h | Help and full flag list |
htop -V | Version |
Essential Keys
| Key | Action |
|---|
F1 / h | Help |
F2 / S | Setup (meters, colors, columns, display options) |
F3 / / | Incremental search by process name |
F4 / \ | Filter: show only matching processes |
F5 / t | Toggle tree view |
F6 / > | Choose the sort column |
F7 / ] | Increase priority (lower nice — needs root) |
F8 / [ | Decrease priority (raise nice) |
F9 / k | Send a signal to the selected process (kill menu) |
F10 / q | Quit |
Selecting and Acting on Processes
| Key | Action |
|---|
Space | Tag/untag a process (act on many at once) |
U | Untag all processes |
c | Tag process and its children |
k | Open the signal menu (SIGTERM, SIGKILL, SIGHUP, …) |
a | Set CPU affinity for the process (where supported) |
l | List open files for the process (lsof) |
s | Trace syscalls with strace |
e | Show the process environment variables |
i | Set I/O scheduling priority (ionice) |
Sorting and Display Toggles
| Key | Action |
|---|
P | Sort by CPU usage |
M | Sort by memory usage |
T | Sort by accumulated CPU time |
I | Invert the current sort order |
H | Show/hide user threads |
K | Show/hide kernel threads |
p | Show/hide full program paths |
F | Follow the selected process as the list re-sorts |
u | Filter the list by a chosen user |
+ / - | Expand/collapse a subtree (in tree view) |
Reading the Meters
| Element | Meaning |
|---|
| CPU bars | Per-core load; colors: blue = low-priority, green = normal/user, red = kernel/system, orange = IRQ |
| Mem bar | green = used, blue = buffers, yellow/orange = cache |
| Swap bar | red = used swap |
| Load average | 1/5/15-minute run-queue averages |
PRI / NI | Kernel priority and nice value |
VIRT / RES / SHR | Virtual, resident, and shared memory |
S | Process 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
| Feature | top | htop | btop |
|---|
| Scroll / mouse | Limited | Yes | Yes |
| Process tree | Limited | Yes (F5) | Yes |
| Search & filter | No | Yes (F3/F4) | Yes |
| One-key signals | No | Yes (F9) | Yes |
| Graphs | No | Bars | Rich graphs |
| Resource footprint | Lowest | Low | Higher |
| Availability | Universal | Very wide | Newer |
Resources