htop is an interactive process viewer — a better top. It shows CPU, memory, running processes, and lets you kill or renice processes without typing PIDs.
Installation
| |
The Interface
Top Section
- CPU bars: Usage per core (user, system, nice, IRQ, etc.)
- Memory bar: Used/total RAM
- Swap bar: Used/total swap
- Tasks: Process count, threads, running processes
- Load average: 1, 5, 15 minute averages
- Uptime: System uptime
Process Columns
- PID: Process ID
- USER: Owner
- PRI: Priority
- NI: Nice value (-20 to 19, lower = higher priority)
- VIRT: Virtual memory
- RES: Resident (physical) memory
- SHR: Shared memory
- S: State (R=running, S=sleeping, Z=zombie, D=disk wait)
- CPU%: CPU usage
- MEM%: Memory usage
- TIME+: Total CPU time
- Command: Process command
Navigation
Function Keys
Sorting
Process Actions
Kill a Process
Kill Multiple Processes
Change Priority (Nice)
Tree View
Press F5 to toggle tree view — shows parent/child relationships:
Useful for seeing process hierarchies and finding runaway child processes.
Filtering
By User
By Name
Search
Configuration (F2)
htop is highly customizable:
Meters (top section)
- Add/remove CPU, memory, load meters
- Change meter styles (bar, text, graph)
- Rearrange columns
Display Options
- Show threads (H)
- Show kernel threads (K)
- Show custom thread names
- Hide userland threads
Colors
- Choose color scheme
- Customize individual elements
Configuration is saved to ~/.config/htop/htoprc
Command Line Options
| |
Reading CPU Bars
The colors in CPU bars mean different things:
Practical Scenarios
Find CPU Hogs
Find Memory Leaks
Kill Zombie Processes
Monitor Specific Application
| |
Check Load During Deployment
htop vs top
| Feature | htop | top |
|---|---|---|
| Color | Yes | Limited |
| Mouse | Yes | No |
| Scroll | Yes | No |
| Tree view | Yes | No |
| Kill without PID | Yes | No |
| Easy config | Yes | No |
Alternatives
| |
Quick Reference
| Key | Action |
|---|---|
F5 | Tree view |
F6 | Sort menu |
F9 | Kill process |
P | Sort by CPU |
M | Sort by memory |
T | Sort by time |
u | Filter by user |
/ | Search |
\ | Filter |
Space | Tag process |
H | Toggle threads |
K | Toggle kernel threads |
htop makes process management visual and interactive. Learn the function keys, use tree view to understand process relationships, and you’ll debug server issues faster. It’s usually the first thing I install on a new system.