htop is a powerful terminal-based system monitoring application that presents data of various system processes and their resource consumption in a human-readable, color-coded, easy-to-use format. htop is a replacement, or rather supplement to the well-known, tried and tested “top”, offering many enhancements such as mouse support, the direct killing of processes, and a more human-readable output.
Installing htop is simple as it is included in the standard repositories of most major distributions. On any Debian derivative, you could just use
The User Interface
The user interface is divided into three parts.
You get bar-like interactive gauges that are configurable to your liking (1), a short summary of running tasks, load average and uptime (2) and a detailed view of running processes (3), and a quick list of the most common keyboard shortcuts, also accessible with a mouse (4).
The bars in the CPU and Memory % gauges are color coded.
While running tasks, load average, and uptime should be self-explanatory, the many stats displayed in the largest portion of the screen might require some clarification. According to htop’s man page, the columns shown by default are to be read the following way:
PID: The process ID.
USER: The username of the process owner or the user ID if the name can’t be determined.
PRI: The kernels internal priority for the process, usually just its NI value plus twenty. Different for real-time processes.
NI: The nice value of a process, from 19 (low priority) to -20 (high priority). A high value means the process is being nice, letting others have a higher relative priority. Only root can lower the value.
VIRT: Size in memory of the total program size.
RES: The resident set size, i.e. the size of the text and data sections, plus stack usage.
SHR: The size of the process’s shared pages.
S: The state of the process.
S: for sleeping (idle)
R: for running
D: for disk sleep (uninterruptible)
Z: for zombie (waiting for parent to read its exit status)
T: for traced or suspended (e.g by SIGTSTP)
W: for paging
CPU%: The percentage of the CPU time that the process is currently using.
MEM%: The percentage of memory the process is currently using (based on the process’s resident memory size, see M_RESIDENT below).
TIME+: The time, measured in clock ticks that the process has spent in user and system time (see UTIME, STIME above).
Command: Full path of the command.
These columns are of course configurable; either one could be hidden and other ones shown in place. For a full list of available metrics, see
The true power of htop, besides its configurability, lies in its various capabilities, accessible via shortkeys. The shortcuts displayed in the bottom are mostly self explanatory. All the displayed shortcuts have alternatives in case they would collide with other WM specific or globally set keyboard shortcuts.
F1 Help – The help screen is a detailed view of all available shortcuts and their alternatives. (Alternative: h)
F2 Setup – Entering the setup menu you will find you can tweak htop’s different features rather easily. (Alternative: Shift + s)
Use the arrow keys or the mouse to navigate the columns for “Setup” (these are the submenus), “Left column,” “Right column” or “Available meters.” Your further navigation options will be displayed dynamically in the bottom row.
Meters will allow you to change what meters are shown in which column in the top part where the gauges and load averages live. F4 will change the type of any selected meter between “Bar,” “Text, ”Graph” and ”LED,” letting you customize the appearance of htop.
Display options will offer some minor tweaks.
Colours lets you change colour schemes.
while Columns allows you to configure what is shown in the main part of the screen and tweak the exact metrics displayed for each individual process.
F3 Search lets you search processes while F4 Filter allows you to filter processes by keywords (Alternatives: / and )
F5 Tree toggles the tree view under the Command column, letting you see process trees instead of individual lines for each command. (Alternative: t)
F6 Sort by will allow you to sort processes by any currently displayed metric. Pressing Shift + i will invert the sorting order. (Alternative: >; there are also shortcuts for the most common sorting options: CPU%: Shift + P, MEM%: Shift + M and TIME: Shift + t)
F7 and F8 Nice +/- will decrease/increase the nice value of any process, but you must run htop as root to use this. (Alternatives: ] and [)
F9 Kill presents you with a complete list of signals to choose from, in order to kill a process, defaulting to SIGTERM (alternative: k)
F10 Quit will simply quit htop. (Alternative: q)
Other useful shortkeys
Space – tag a process
c – tag process and child processes
Shift + u – Remove all tags
Shift + f – Cursor follows process. This means if you highlighted a process, and its place in the list changes for any reason, it will remain highlighted and the cursor will follow it (This is a toggle option)
Shift + h and Shift + K will Show/Hide user and kernel processes respectively
u – will let you choose a user and display only processes belonging to its ID.
There are some system administration options available as well:
a – will let you set what CPUs or CPU cores a given process can access
i – will set I/O priority
The last three functions need external programs to be installed:
s – will trace process system calls with strace. If you don’t have strace on your system, you can install it with
l – will show a list of files open by the process using lsof. (In UNIX world “everything is file,” so you can get a real useful output)
if there is no lsof, you can install it with
sudoapt-get install lsof
Shift + L – will use ltrace to trace all library calls by the highlighted process
Install ltrace with
As simple as htop looks, its human-readable interface, many configuration options and abilities to represent system data in many different ways, makes it one of the must-have tools for the system administrator. Although top might be older and more “tried and tested,” htop’s improved interface and capabilities make it an excellent alternative or even replacement.