top works. htop works better. It’s colorful, interactive, and actually pleasant to use. Here’s how to get the most from it.

Installation

1
2
3
4
5
6
7
8
# Debian/Ubuntu
sudo apt install htop

# RHEL/CentOS/Fedora
sudo dnf install htop

# macOS
brew install htop

The Interface

Launch with htop. You’ll see:

Top section:

  • CPU bars (one per core)
  • Memory and swap usage
  • Tasks, load average, uptime

Process list:

  • PID, user, CPU%, MEM%, time, command

Bottom:

  • Function key shortcuts

Essential Shortcuts

KeyAction
F1 or hHelp
F2 or SSetup menu
F3 or /Search
F4 or \Filter
F5 or tTree view
F6 or >Sort by column
F9 or kKill process
F10 or qQuit
SpaceTag process
UUntag all
uFilter by user

Tree View

Press F5 to see process hierarchy:

systenpmgodisntxnngppggrooiiessnnsttxxggrrwweeoossrr::kkeewbrrraictkegrround

This shows parent-child relationships — crucial for understanding what spawned what.

Sorting

Press F6 to sort by:

  • CPU% — What’s eating CPU?
  • MEM% — Memory hogs
  • TIME+ — Long-running processes
  • PID — Process ID order

Or click column headers directly.

Search (F3): Find process by name, jumps to first match.

Filter (F4): Shows only matching processes. Type python to see only Python processes.

Clear filter with F4Esc.

Killing Processes

  1. Navigate to process
  2. Press F9 (or k)
  3. Select signal:
    • 15 SIGTERM — Graceful shutdown
    • 9 SIGKILL — Force kill
  4. Press Enter

Or tag multiple processes with Space, then kill all tagged.

User Filter

Press u to filter by user. Useful for seeing just your processes or a service account’s.

Column Customization

Press F2 → Columns to add/remove:

Useful additions:

  • IO_READ/IO_WRITE — Disk I/O
  • STARTTIME — When process started
  • PROCESSOR — Which CPU core
  • STATE — R (running), S (sleeping), D (disk wait), Z (zombie)

CPU and Memory Meters

In setup (F2 → Meters), customize the top display:

Options include:

  • CPU average vs per-core
  • CPU frequency
  • Tasks (running, total)
  • Load average
  • Hostname
  • Clock

Practical Scenarios

Find Memory Hog

  1. Launch htop
  2. Press F6 → MEM%
  3. Top processes are your culprits

Find Runaway CPU

  1. Launch htop
  2. Press F6 → CPU%
  3. Watch for sustained 100%

Kill Stuck Process

  1. F3 to search
  2. Navigate to process
  3. F99 (SIGKILL) → Enter

Monitor Specific App

1
htop -p $(pgrep -d',' python)

Shows only Python processes.

See What User is Running

1
htop -u nginx

Or press u inside htop and select user.

Config File

htop saves settings to ~/.config/htop/htoprc. Share this file across machines for consistent setup.

Key settings:

1
2
3
4
tree_view=1
sort_key=46  # CPU%
highlight_base_name=1
show_program_path=0

htop vs top

Featuretophtop
ColorsNoYes
Mouse supportNoYes
Horizontal scrollNoYes
Tree viewLimitedFull
Kill from UIAwkwardEasy
FilterNoYes
UsabilityMehGreat

Use top when htop isn’t installed. Otherwise, htop every time.

Alternatives

  • btop — Even prettier, with graphs
  • glances — System monitoring dashboard
  • atop — Historical logging
  • bottom — Rust rewrite, very fast

But htop is the universal standard. It’s everywhere and it works.

Quick Start

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Basic usage
htop

# Filter by user
htop -u deploy

# Filter by PID
htop -p 1234,5678

# No color (for scripting)
htop -C

htop is the process manager you’ll actually enjoy using. Install it everywhere.


Computing Arts covers the tools that make production bearable. More at computingarts.com.