htop is an interactive process viewer that improves on top in almost every way: colour, mouse support, scrollable process list, horizontal scrolling to see full command lines, built-in search, tree view, and a configurable meters header. It is a third-party package, installable on any distribution, and has become the de facto go-to tool for anyone who spends serious time watching processes.
Its main features include per-CPU and memory usage bars at the top, tree view (F5) showing parent-child relationships, search (F3) and filter (F4) for finding processes by name, sort (F6) on any column, kill (F9) with signal selection, renice (F7/F8), and setup (F2) for customising colour scheme and displayed meters.
htop does not attempt to do everything: it is strictly an interactive tool, and its snapshot data is not convenient for scripting. For that, use ps, pidstat, or query /proc directly. But for the "what is this machine doing right now?" question, htop is the tool to reach for. Its sibling btop adds even more eye candy and is gaining popularity.
Discussed in:
- Chapter 10: Processes and Job Control — Looking at Processes
Also defined in: Textbook of Linux