htop — Interactive Process Monitor for the Terminal

Practical guide to htop — monitor, sort, filter and kill processes live in the terminal with the comfortable, colourful top replacement.

htop is an interactive process viewer for the terminal and a comfortable replacement for top: colour-coded CPU and memory meters, mouse support, a tree view and the ability to kill processes with a single keystroke – without typing PIDs. This guide walks you through the command-line options for launching htop and the keys that matter most while it runs, from searching and filtering to sorting and adjusting nice values.

Basic Usage

htop — Start htop in interactive mode.

htop

htop -u USER — Show only processes belonging to a specific user.

htop -u www-data

htop -p PID1,PID2 — Monitor specific processes by PID.

htop -p 1234,5678

htop -d TENTHS — Set the update delay in tenths of seconds (default: 15 = 1.5s).

htop -d 10

htop -t — Start in tree view mode.

htop -t

htop -s COLUMN — Sort by a specific column.

htop -s PERCENT_MEM

htop -H — Highlight new and old (changed) processes on startup.

htop -H

htop -C — Start in monochrome (no color) mode.

htop -C

Function Keys (Bottom Bar)

F1 / h — Help screen.

F2 / S — Setup — configure meters, columns, colors, and display options.

F3 / / — Incremental search by process name.

F4 / \ — Filter processes by name (only matching processes shown).

F5 / t — Toggle tree/forest view.

F6 / > — Sort by a selected column.

F7 — Decrease nice value (increase priority) of selected process.

F8 — Increase nice value (decrease priority) of selected process.

F9 / k — Kill selected process (choose signal from menu).

F10 / q — Quit htop.

↑ / ↓ — Move cursor up/down through process list.

← / → — Scroll horizontally to see full command lines.

PgUp / PgDn — Scroll one page up/down.

Home / End — Jump to top/bottom of process list.

Space — Tag/untag a process (for batch operations).

U — Untag all processes.

c — Tag process and its children.

Sorting

P — Sort by CPU usage.

M — Sort by memory usage.

T — Sort by time.

I — Invert sort order.

F6 / > — Open sort column selector.

Display Toggles

H — Toggle user threads display.

K — Toggle kernel threads display.

t / F5 — Toggle tree view.

p — Toggle program path in command column.

m — Toggle merged command display (useful for multi-threaded apps).

e — Show environment variables for selected process.

w — Wrap long command lines.

u — Show only processes of a selected user.

Process Actions

k / F9 — Kill selected process. Shows signal selection menu.

F7 / ] — Decrease nice value (higher priority). Requires root.

F8 / [ — Increase nice value (lower priority).

l — Show open files for selected process (lsof).

s — Show system calls for selected process (strace).

a — Set CPU affinity for selected process.

i — Set I/O priority for selected process (ionice).

Header Meters

CPU bars — Color-coded: blue=low-priority, green=normal, red=kernel, cyan=virtualized, gray=I/O wait.

Memory bar — Color-coded: green=used, blue=buffers, orange/yellow=cache, cyan=ZFS cache.

Swap bar — Red=swap used. Any swap usage may indicate memory pressure.

Load average — 1/5/15 minute averages. Compare against CPU count.

Uptime — System uptime since last boot.

Tasks — Total processes, threads, running, and kernel threads.

Conclusion

htop makes system monitoring fast and tangible: one invocation shows load, memory and processes in real time, and search (/), filter (F4), tree view (F5) and sorting (F6) are all a keystroke away. Be careful with F9/k, though: a kill terminates the selected process immediately, and any unsaved work in a running process is lost – check the target and the signal before you confirm. Your settings (meters, columns, colours) live in ~/.config/htop/htoprc. If htop feels too plain, btop (a modern, more graphical monitor) and the classic top are both worth a look.

Further Reading

  • top – the classic process monitor, pre-installed on almost every system
  • ps – one-off snapshot of running processes for scripts and pipes
  • free – show free and used physical and swap memory