skip to content

You are triaging a busy Linux server that has both top and htop installed. What does htop's interactive display give you that a flat, non-interactive process list does not, and what do its per-core CPU meters and their coloured segments actually show?

level: juniorimportance: should knowfreq 62%

answer

  1. one bar per core, not one number
  2. colour says where the time went
  3. tree view exposes the parent
  4. full command line separates identical workers
  5. detailed mode splits out steal and IO-wait

basics

~20 s

htop adds an interactive view a static list cannot: one meter per CPU core, a process tree, full command lines, and search, filter and signal keys. Each core bar splits its usage by colour — green user time, red kernel time, blue niced work.

solid answer

~50 s

htop reads the same `/proc` data as a static process list, but presents it as a live, navigable screen, and the navigation is the point. The header draws one meter per logical CPU, so I can see immediately whether one core is pinned while the others idle — a single-threaded bottleneck — or whether every core is busy and the box is genuinely out of CPU. Each bar is split by colour: in htop 3's default scheme green is normal user time, red is kernel time and blue is low-priority (niced) work, and turning on *Detailed CPU time* in the F2 setup screen splits out IRQ, soft-IRQ, IO-wait, steal and guest time. In the list itself I get the process tree with F5, the full command line rather than a truncated name, incremental search with `/`, a filter with `\`, and tagging with Space so I can act on what I found without leaving the screen.

go deeper

for a junior

Be able to say plainly that htop draws one bar per CPU core, colours each bar by where the time went, and refreshes live rather than averaging since boot. Know that F5 gives a tree and that the Command column shows full arguments.

for a middle

Expect to interpret the shape rather than recite the legend: one pinned core with the rest idle means a single-threaded workload, and a mostly red bar means the time is going into the kernel, which changes the tool you reach for next.

for a senior

Show that you use the display to direct an investigation and then leave it — narrow with the tree and the full command line, form a hypothesis from the colour split, and move to a tracer or profiler. Reading bars is orientation, not evidence.

for a principal

Own the question of whether anyone should be reading bars at all. A live viewer is one person looking at one box with no history and no record; say where hand-run tools still earn their place and where a fleet needs collected numbers instead.

## What htop actually is htop is a full-screen, interactive process viewer built on ncurses. It has no privileged access and no special data source: like every other process viewer on Linux it reads `/proc` — `/proc/stat` for CPU time, `/proc/meminfo` for memory, and a handful of files under `/proc/<pid>/` for each task. The entire difference is the interface. That matters more than it sounds, because during triage the limiting factor is usually not what data exists but how fast you can navigate to the row that matters. ## The header: one meter per logical CPU By default htop draws one bar per logical CPU as the kernel counts them, so a machine with 8 hardware threads gets 8 bars. Each bar shows how that core's time was spent **during the last refresh interval** (roughly a second and a half by default), not since boot. That distinction is the source of a lot of confusion: the bars are a rate, and they move. The single most valuable reading skill is the *shape* of the meters rather than any one number: - One bar pinned near 100% while the rest sit near zero: a single-threaded workload. The machine is not out of CPU — one thread is out of CPU. Adding cores does nothing; adding worker processes, or making the hot path cheaper, does. - Every bar high: the host really is CPU-saturated, and the next question is which processes own the time. - Bars bouncing between cores: work that migrates, typical of many short-lived tasks. ## What the colours mean In htop 3's default colour scheme each bar is subdivided: - **green** — time spent in user space at normal priority; - **red** — kernel (system) time; - **blue** — low-priority, niced user time. A bar that is mostly red is a genuine finding, not a decoration: the workload is spending its time inside the kernel on that task's behalf — heavy syscall traffic, filesystem work, softirq handling for network load. That points you at a syscall tracer or a profiler next, not at a bigger instance type. A bar that is mostly green points at the application's own code. Enabling *Detailed CPU time* under F2 Setup splits each bar further, exposing IRQ, soft-IRQ, IO-wait, steal and guest time as separate segments. On a virtual machine a visible steal segment is worth noticing: the CPU you were promised is being spent elsewhere by the hypervisor, and no amount of application tuning will recover it. ## The process panel: tree view and the full command line F5 (or `t`) toggles the tree view, indenting children under their parents. This is the fastest way to answer "where did this come from?" — that forty identical worker rows all descend from one master process, or that the runaway was launched by a wrapper script from a scheduled job rather than by the service manager. htop also shows the **full command line** from `/proc/<pid>/cmdline` rather than a truncated program name, and the row scrolls horizontally. When a host runs dozens of processes with the same executable name, the arguments are usually the only thing that distinguishes them: which queue, which config file, which shard. The F2 setup screen controls presentation details here, such as whether the program path is shown and whether the basename is highlighted; the settings persist to `~/.config/htop/htoprc`. ## Finding a row: search versus filter Two keys do superficially similar things and are worth keeping straight: - `/` (F3) is **incremental search**: it moves the cursor to the next matching row and leaves the rest of the list intact, so you keep the surrounding context. - `\` (F4) is a **filter**: rows that do not match are hidden until you clear it. `u` narrows to one user, `H` toggles display of user threads, and `K` toggles kernel threads. F6 changes the sort column, and htop accepts mouse clicks on column headers and on the function-key bar. Command-line options preselect the same states, which is handy when you always want the same view: ``` htop -t -u www-data ``` ## Where the interactivity stops helping Because it is only an interface, htop adds no data the static tools lack, keeps no history, and produces no artefact you can attach to a ticket. It is an excellent way to *look*, and a poor way to *record*. Use it to orient yourself and to find the row that matters; move to a snapshot or a sampled stream the moment you need something to keep.

  • You suspect a virtual machine is being starved by its hypervisor. Can htop show you that?
    Yes. Turn on Detailed CPU time in the F2 setup screen and each core bar gains separate segments for IRQ, soft-IRQ, IO-wait, steal and guest time. A persistent steal segment means the hypervisor is scheduling other tenants on the physical CPU you were promised, so application-level tuning will not recover the lost time.
  • An 8-core host shows one htop bar at 100% and the other seven near idle. What do you conclude?
    That a single thread is saturated, not the machine. Total CPU utilisation is around 12%, so the host has capacity; the bottleneck is one runnable thread that cannot use more than one core. The fix is parallelism — more worker processes, or splitting the hot path — not a larger instance.
  • How do you change which meters appear in htop's header, and does the change survive a restart?
    F2 opens the setup screen, where meters can be added, removed, moved between the left and right columns and switched between bar, text, graph and LED styles. The configuration is written to ~/.config/htop/htoprc, so it persists for that user on that host — and only there.

saying these in an interview costs you the question

  • Says htop is just top with nicer colours
  • Reads one saturated core as the whole machine being CPU-bound
  • Thinks the coloured part of a bar is idle capacity
  • Assumes red segments mean errors or blocked processes
  • Believes the bars are averages since boot

context