top has shipped with Unix systems for decades and shows you everything you need, arranged in a way almost nobody finds readable. htop shows the same information with colour, a scrollable list, a process tree, and the ability to actually do something about what you find. btop adds graphs.

Of all the old-versus-new pairs, this is the one where the modern tool wins most clearly — and where the classic is still the one you have to know.

The short verdict

Install htop on every machine you own. It is the same information, legible, with search, sorting and signalling built in. There is no real argument against it.

Learn top anyway, because it is on every machine including the one you are debugging at 3am, and because you cannot install anything on a box that has run out of memory.

btop is a nicer btop than htop, not a better diagnostic. Take it if you like the graphs; skip it without regret.

What each one gives you

tophtopbtop
PreinstalledAlwaysUsually notNo
ColourMinimalYesYes
Per-core meters1 toggles a listBars, always visibleGraphs
Scroll the process listNoYes, and sidewaysYes
Process treeLimitedF5Yes
Search and filterClumsyF3 and F4Yes
Kill without typing a PIDNoF9Yes
Sort by clickingNoYes, mouse worksYes
Disk I/O per processNoOptional columnYes
Network graphsNoNoYes
Resource use of the tool itselfLowestLowHighest

The row that matters most is “kill without typing a PID”. In top, dealing with a runaway process means reading a PID off the screen, typing k, retyping the PID correctly, then choosing a signal. In htop you arrow to the line, press F9, pick the signal. Under pressure, at 2am, that difference is not cosmetic — mistyping a PID kills the wrong thing.

Installing

# htop
sudo apt install htop        # Debian, Ubuntu
sudo dnf install htop        # Fedora, RHEL, Rocky, Alma
sudo pacman -S htop          # Arch

# btop
sudo apt install btop
sudo dnf install btop
sudo pacman -S btop

On RHEL, Rocky and Alma, both usually need EPEL enabled first: sudo dnf install epel-release.

The htop keys worth knowing

Six keys turn htop from a prettier top into a real diagnostic tool.

KeyDoesUse it when
F6 or >Choose the sort column“What is using the memory?”
F4Filter the list by textWatching one application’s processes
F3Search and jumpFinding one process by name
F5Tree view“Which parent spawned all of these?”
F9Send a signalStopping something, safely
uShow one user onlyShared machines
HHide threadsJava or Chrome filling the screen
F2Settings, saved to diskSetting up your defaults once

H is the underrated one. By default htop lists every thread, so a JVM or a browser can produce sixty rows for one program and hide everything else. Pressing H collapses them to one line per process and the list becomes readable again.

F5 answers a question nothing else answers well. Tree view shows the parent-child structure, so when twenty PHP workers are eating the machine you can see they all descend from one php-fpm master — and that restarting that master is the fix, not killing twenty processes individually. Processes and memory covers why that structure exists.

Set your defaults once with F2 and they persist in ~/.config/htop/htoprc. Worth turning on: hiding threads by default, and adding the IO_RATE column so you can see which process is hammering the disk.

Reading the header

Both tools show the same summary at the top, and it is worth knowing what the colours in htop’s bars mean, because they encode information the numbers alone do not.

In the CPU barMeans
GreenNormal user processes
RedKernel time — high red suggests heavy I/O or system calls
BlueLow-priority (niced) processes
OrangeI/O wait — the CPU is idle, waiting for disk
In the memory barMeans
GreenActually in use by programs
BlueBuffers
Yellow/orangeCache — reclaimable, not a problem

That memory bar is the fastest cure for the most common misreading in Linux. A bar that looks nearly full but is mostly yellow means the machine is caching, not struggling — and htop shows you that at a glance where free -h requires knowing which column to read.

Similarly, a lot of orange in the CPU bars means the processor is waiting on storage. If the machine feels slow and the CPU bars are orange rather than green, no amount of CPU tuning will help — the disk is the bottleneck.

The top keys worth knowing

You will end up on a machine with only top. These five make it survivable.

KeyDoes
MSort by memory
PSort by CPU (the default)
1Show each core separately
cShow the full command line, not just the name
uFilter to one user
kKill, by typing a PID
qQuit

M and c are the two that matter. M because “what is eating the memory” is the most common question you arrive with, and c because “python3” tells you nothing while the full command line tells you exactly which script is misbehaving.

top also has a batch mode, which htop’s interactivity cannot replace — it is how you capture a snapshot into a file or a script:

# One snapshot, non-interactive
top -b -n 1 | head -20

# Log the top processes every 30 seconds
top -b -d 30 >> /var/log/top-snapshot.log

# Just one process, over time
top -b -p 1481 -d 5

That last pattern is genuinely useful for a problem that only happens at 4am: leave it logging, read it in the morning.

Where top is still the right answer

  • Any machine you do not control. Customer servers, minimal containers, appliances, rescue environments. top is there; htop is not.
  • A machine already in trouble. When memory is exhausted you cannot install a package, and top uses less of what little is left.
  • Scripts and logging. top -b produces parseable output. htop is designed for a human looking at it.
  • Over a slow or awkward connection, where htop’s full-screen redraws are more painful than top’s.

The same rule as the rest of this section applies, with one adjustment: learn top, install htop — and here the learning genuinely is a fallback skill rather than a daily one. You will use htop nearly every time. You will need top perhaps twice a year, on the worst two days.

Where btop fits

btop is genuinely beautiful: scrolling CPU graphs, per-process disk and network activity, mouse-driven everything. On a desktop or a machine you are watching deliberately it is a pleasure.

For diagnosis, be honest about what it adds. Historical graphs help you see whether a spike is new or constant, and the per-process network view is something neither of the others has. Everything else is presentation. It also uses noticeably more CPU than htop, which is a poor trade on a machine that is already struggling.

Worth knowing about the wider family, since they answer different questions:

ToolAnswers
htopWhat is using CPU and memory, right now
btopThe same, with history and network
iotopWhich process is hitting the disk
nethogsWhich process is using the network
glancesEverything at once, with a web mode

sudo iotop -o is the one to remember from that list. When the load average is high and the CPU is idle, it names the process responsible in about two seconds — a question none of top, htop or btop answers directly.

Quick reference

You wantDo this
What is using the memory (htop)F6, choose PERCENT_MEM
What is using the memory (top)Press M
See the full command line (top)Press c
Collapse threads (htop)Press H
See what spawned what (htop)Press F5
Kill safely (htop)F9, then choose SIGTERM
Watch one process onlytop -b -p PID -d 5
Snapshot into a filetop -b -n 1 > snapshot.txt
Which process is hitting the disksudo iotop -o

Related reading