The htop command in Linux: interactive process monitor

Introduction

In the world of Linux system administration, having tools that provide a clear and real-time view of resource usage is essential for diagnosing problems and optimizing performance. Although the top command has been the de facto standard for years for monitoring processes, its static interface and limited interactivity can be insufficient for users seeking a more user-friendly and visual experience. This is where htop comes in, a modern alternative that combines the power of top with an ncurses-based interface, colors, and keyboard navigation. This post explores what htop is, how to install it, how to interpret its screen, and what advanced features it offers to get the most out of it in production and development environments.

What is htop?

htop is an interactive process monitor written in C that uses the ncurses library to draw a screen divided into several areas. At the top it shows a summary of CPU, memory, and swap usage, accompanied by colored progress bars that facilitate immediate identification of bottlenecks. In the center each process is listed with its PID, user, priority, memory consumption, and CPU percentage, sorted by default by CPU usage. Unlike top, htop allows vertical and horizontal scrolling using the arrow keys, searching for processes with the F3 key, and killing or renegotiating priorities with F9 and F7 respectively. Moreover, its modular design allows adding custom columns, changing the color scheme, and saving configurations for future sessions.

Installation

The installation of htop varies depending on the distribution, but in most cases it is available in the official repositories.

  • On Debian-based distributions such as Ubuntu or Linux Mint, simply run sudo apt update followed by sudo apt install htop.
  • On Red Hat-based systems such as CentOS, Fedora, or Rocky Linux, use dnf install htop or yum install htop depending on the version.
  • On Arch Linux and its derivatives, the command is sudo pacman -S htop.
  • For users who prefer to compile from source, the official GitHub repository provides the code and instructions to compile with make and make install.

After installation, simply type htop in any terminal to launch the interface.

Interface and navigation

When starting htop, the screen is divided into three main sections. The top bar shows the usage of each CPU core as colored bars, followed by RAM and swap, with numeric values and percentages. Just below, the process list occupies most of the screen; each row represents a process and can be sorted by clicking the column header or pressing F6 to select the sort criterion. Navigation is done with the up and down arrows to move between processes, and left and right to scroll horizontally when the list exceeds the terminal width. The function keys provide shortcuts:

  • F1 opens the help.
  • F2 allows configuring display options.
  • F3 searches for a process by name.
  • F4 incremental filter.
  • F5 shows the process tree view.
  • F6 chooses the sort criterion.
  • F7 and F8 decrease or increase the nice value.
  • F9 sends a signal to terminate or send other signals to the selected process.

Advanced features

Beyond basic visualization, htop includes several features that make it a powerful diagnostic tool.

  • The tree view (activated with F5) shows parent‑child relationships between processes, making it easier to identify processes spawned by a specific service.
  • The incremental filter (F4) allows typing part of a process name and viewing only those that match, which is useful when looking for a specific service among hundreds of entries.
  • It is possible to mark several processes with the space bar and apply a signal to all of them simultaneously with F9, grouping tasks such as killing all processes of a user.
  • htop supports column customization via the configuration menu (F2), where you can add information such as I/O index, start time, or execution environment.
  • The configuration is saved in the file ~/.config/htop/htoprc, allowing each user to have their own color scheme and column layout.

Conclusion

htop has become one of the most appreciated tools by system administrators, developers, and Linux enthusiasts thanks to its combination of detailed information, interactivity, and customization. Its learning curve is quick: just knowing the most used function keys is enough to go from simple observation to active control over system processes. If you haven’t tried it yet, installing htop and spending a few minutes exploring its interface will change the way you monitor and manage resources on your Linux machine.

This post is also available in ESPAÑOL.

Leave a Reply

Your email address will not be published. Required fields are marked *

Esta obra está bajo una Licencia Creative Commons Atribución 4.0 Internacional para Francesc Roig francesc@vivaldi.net .