Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

htop Command Guide for a Human-Friendly Process Monitor

This guide helps you understand and use the htop command, the interactive process viewer that makes top feel modern.


What is htop, and Why Use It?

The htop command is an improved, interactive process viewer: color-coded usage bars, horizontal and vertical scrolling, mouse support, easy process searching, and tree view of parent-child relationships. It is not installed by default on most systems — you install it like any other package — but once you have it, going back to plain top feels like downgrading.

Why Learn htop?

  • Usability: Colors, bars, and single-key actions make the system easy to read at a glance.
  • Tree view: See which process spawned which, instead of a flat alphabetical list.
  • Mouse and scrolling: Scroll the full process list instead of being stuck with the first screenful.
  • It is on every server you will meet: Once installed, it is the first thing experienced admins open.

htop takes the same data top shows and makes it feel like a dashboard instead of a spreadsheet.


1. Start htop

htop
  • If it is missing, install it first — see the Package Management section of this book for your distro;
  • The screen shows CPU and memory bars at the top and the process table below;
  • Press F1 for help, q or F10 to quit.

F3    search for a process by name
F4    filter to matching processes
/     same as F3 in newer versions
  • Press F3 and start typing — matches are highlighted as you type;
  • Enter jumps to the next match;
  • Press F4 instead of F3 to hide everything that does not match — a live filter, similar to grep on the process list.

3. Sort and Scroll

<    and >    change the sort column
M        sort by %MEM (P for %CPU)
T        sort by TIME
Arrow keys    scroll the process list
Home / End    jump to the top or bottom
  • The sort column can be any usage metric;
  • Arrow keys scroll the full list — no more first-screen-only views;
  • H hides user threads, K hides kernel threads, for a cleaner list.

4. Kill, Renice, and Trace from the Keyboard

F9     send a signal (kill menu)
F10    quit
  • Press F9 to open the signal menu — choose signal 15 (SIGTERM) politely, 9 (SIGKILL) forcibly;
  • F9 works on the highlighted process, or on several at once if you have marked them;
  • Press c to toggle the full command path, so you see exactly which binary each process runs.

5. Show the Process Tree

F5     tree view
  • The tree view indents every child under its parent;
  • This is how you see that a web server spawned its workers, or that a script started a chain of commands;
  • Press F5 again for the flat view.

6. Save the Layout for Next Time

htop
# choose "Setup" from F1 (Setup), adjust options, then
# "Save setup to ~/.config/htop/htoprc"
  • htop remembers nothing by default;
  • The Setup screen (inside the F1 help) lets you set the sort column, colors, and tree options;
  • Saving the setup makes every future session start the way you like.

Common Pitfalls

  • Expecting it to be installed: htop is a package, not a given — on a fresh server, install it before you need it, not during an outage.
  • Trusting colors blindly: The red and magenta bars are configurable; a color does not always mean “bad.”
  • Forgetting it is interactive: htop has no batch mode like top -b — for scripted monitoring, use top -b or plain ps.

PageDescription
topThe classic monitor htop improves on
psThe snapshot view for scripts
killStop processes — also reachable via F9
reniceChange priority of a process

htop Cheatsheet

TaskCommand
Starthtop
Search a processF3 or /
Filter to matchesF4
Tree viewF5
Kill / signal menuF9
Sort by CPU / memoryP / M
Show full command pathc
HelpF1
QuitF10 or q