htop is an interactive process viewer — a friendlier top with colour meters, scrolling, mouse support, a process tree and easy killing and filtering. It’s usually the first thing admins install on a new server.

Install

sudo apt install htop         # Debian/Ubuntu
sudo dnf install htop         # Fedora; AlmaLinux/Rocky via EPEL

Run it with htop (or sudo htop to manage other users’ processes).

Reading the meters

The top section shows one bar per CPU core, plus memory and swap.

CPU bar colours (default scheme):

Colour Meaning
Blue Low-priority (niced) processes
Green Normal user processes
Red Kernel time
Cyan / light blue Steal time (virtual machines) — enable “Detailed CPU time” in setup
Grey I/O wait (with detailed CPU time)

Memory bar:

Colour Meaning
Green Used by processes
Blue Buffers
Yellow/orange Cache

Cache is reclaimable, so a “full” memory bar that’s mostly yellow is healthy. See the free command for why.

To the right: Tasks (processes, threads, running), Load average (1/5/15 minutes — compare with your core count) and Uptime.

Turn on detailed CPU time

Press F2 (Setup) → Display options → enable Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest). Now the bars show I/O wait and steal time separately — essential on a VPS for telling disk bottlenecks and host contention apart from real CPU load.

Keys you’ll use

Key Action
F3 or / Search for a process
F4 or \ Filter (show only matching processes)
F5 or t Tree view (parent/child)
F6 or < > Choose sort column
P / M / T Sort by CPU / memory / time
F9 or k Send a signal (kill)
F7 / F8 Lower / raise priority (nice)
u Show one user’s processes
H Hide/show user threads
K Hide/show kernel threads
Space Tag a process (act on several at once)
e Show the selected process’s environment
l Open files of the process (needs lsof)
s Trace system calls (needs strace)
F2 Setup
F10 or q Quit

Mouse clicks work too: click a column header to sort, click a process to select it.

Practical tasks

Find what’s eating CPU: press P, look at the top entries. Press F5 to see whether it’s a child of something else (e.g. a PHP-FPM worker under its master, or a script started by cron).

Find what’s eating memory: press M. The RES column is physical memory. Many PHP-FPM or Apache workers each showing 80–150 MB explains a memory-hungry web server.

Kill a stuck process: select it, F9, choose 15 SIGTERM first (lets it shut down cleanly); use 9 SIGKILL only if it doesn’t respond. See killing processes.

Watch one service: F4 and type nginx or mysql.

Threads: by default htop shows userland threads in a different colour. Press H to hide them for a cleaner view of processes; for multi-threaded apps (Java, databases), showing them helps find a busy thread.

Useful columns to add

F2 → Screens / Columns lets you add columns, for example:

  • IO_READ_RATE, IO_WRITE_RATE — per-process disk I/O (run as root).
  • PERCENT_SWAP / M_SWAP — swap used per process.
  • STARTTIME — when the process started.
  • OOM — the OOM killer score.

Settings save to ~/.config/htop/htoprc.

Spotting common server problems

What you see Likely cause
All cores red Heavy kernel work — networking, many small I/O operations
Grey (I/O wait) high, many processes in D state Disk bottleneck
Steal high Busy virtualization host
Load average far above core count, CPUs not busy Processes blocked on I/O
Swap bar growing, memory full of green Not enough RAM
Dozens of identical workers at 100% CPU Traffic spike, bot flood, or an infinite loop

htop over SSH and in tmux

htop works fine in any terminal, including inside tmux. If colours look wrong, check that TERM is set to something like xterm-256color.

htop vs top vs others

  • top — always installed; fine for quick checks.
  • htop — easiest interactive use.
  • btop — prettier dashboard with graphs for CPU, memory, disks and network.
  • atop — logs history, for investigating problems after the fact.
  • glances — overview including disks and network, with a web mode.

Related: ps command and CPU and RAM monitoring.

  • Linux
  • Monitoring
  • Performance