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

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

# RHEL/CentOS
sudo yum install htop

# macOS
brew install htop

The Interface

MSew151234mpP26[[I37|D48[[[[|UwpSwoEwsR-tdgarteasPR22I00NI001V05I21R424TMM.2121G0R52/KE6823121/SMM538852......3729601%%%%G0S28]]]]]GHMM]RSSSTLU41aopC52satP..kdiU23sm%:aev:M101eE..4r4M682a%,gdea13:y251sT::21,I34.M43t20E..h43+52r:61;02.2Cnp29:ogo81misr5mntu0axgn.n:rn8dei7wsno:grkwerriter

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
PHSu/gopUmapec//ePEgnDdnMPFTFSFoaiaieivgrglaleestrttpeceuu/rrhrpplo//acbddseyootswwsunnpsreorcess

Function Keys

FFFFFFFFFF12345678910HSSFTSNNKQeeeiroiiiultalercclipurteteeltpcehrvb-+p(iyrce((oowchlcnoioeflgwsiuhesgmerunrrpaprtriiiooornri)ittyy))

Sorting

FPMTI6OSSSSSIpooooonerrrrrvntttttersbbbbbtoyyyyyrstCMTnpoPEIerrmUMMxete%%Etvnioucoroudlseurmcnolumn

Process Actions

Kill a Process

1234....NPS---Parervel192eise5sgscSSsatSIItFIGGEe9sGKIniTINttgELTeoonRLrraM(pl(irk:(fno)gotcrreeacrscerse)ufputl))

Kill Multiple Processes

123...SFAp9lalcteotatkgoigletldagprporcoecsessessesreceivesignal

Change Priority (Nice)

FF78DIenccrreeaasseenniiccee((hliogwheerrpprriioorriittyy),needsroot)

Tree View

Press F5 to toggle tree view — shows parent/child relationships:

systnpegomisdnnntppxgggooiirssnnettxxsgg::rreewwssoo::rrkkwceerhrrietcekrpointer

Useful for seeing process hierarchies and finding runaway child processes.

Filtering

By User

uSSheolwecutseursemrenourtypename

By Name

ETOnyntpleeyrpmfraiotlcctehesirsngmnoapdmreeocessesshown
F3ETNnyetpxeetrtmsoaetascrehcahrcmhode

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Monitor specific user
htop -u www-data

# Start in tree view
htop -t

# Monitor specific PIDs
htop -p 1234,5678

# No color
htop -C

# Show only processes with specific name
htop -F nginx

Reading CPU Bars

The colors in CPU bars mean different things:

BGROMGClreraryuedageaeeneynngneta-------LNKIISooeRSOtwrrQoemnfwapaettalrlliiimIttoppeRirrrQmiooetccyee(ssV(ssMnee)issce)

Practical Scenarios

Find CPU Hogs

123...PTWroaeptscsphrPofcoterosspserosorctaersbesyehsCiPgsUhteasytinCgPUatus1e0r0s%

Find Memory Leaks

123...PCWrhaeetsccskhMRfEotSrocgsoroloruwtminnbgyfommreemmaoocrrtyyualvemremtoirmye

Kill Zombie Processes

123...PFKriienlsdlspp\aarraeennndttfpoirrlotczeeorsmsbfio(ertsr"edZei"rvesictetawltyehelps)

Monitor Specific Application

1
htop -p $(pgrep -d, nginx)

Check Load During Deployment

123...WCMahotenccihktolirofamdpermaoovcreeyrsasfgeoesr(aOsrOheMouscltoduncdskittaiiynonrDseasstoantaebl(ed)iskwait)

htop vs top

Featurehtoptop
ColorYesLimited
MouseYesNo
ScrollYesNo
Tree viewYesNo
Kill without PIDYesNo
Easy configYesNo

Alternatives

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# btop (prettier, more features)
btop

# glances (system overview)
glances

# atop (historical data)
atop

# nmon (performance monitor)
nmon

Quick Reference

KeyAction
F5Tree view
F6Sort menu
F9Kill process
PSort by CPU
MSort by memory
TSort by time
uFilter by user
/Search
\Filter
SpaceTag process
HToggle threads
KToggle 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.