What is htop and how do you use it?
This article provides a comprehensive overview of htop,
an interactive system-monitor process viewer and process manager
designed for Unix-like systems. We will explore its key features, how it
improves upon the traditional top command, how to read its
color-coded interface, and essential keyboard shortcuts for managing
system resources. Whether you are a system administrator or a curious
Linux user, this guide will help you navigate your system’s performance
in real time.
Understanding the htop Interface
Unlike the classic top command, htop
provides a visually rich, text-based user interface that uses color and
graphs to represent system resource usage. When you launch the tool, the
display is split into three main sections: the header, the process list,
and the footer.
The header at the top uses progress bars to show the utilization of each CPU core, followed by memory (RAM) and swap space usage. Colors give you immediate context:
- Blue: Low-priority threads.
- Green: Normal user processes.
- Red: Kernel processes.
- Yellow: IRQ time (for CPUs).
Below the header, the process list displays active system processes. It includes standard metrics such as the Process ID (PID), the user running the process, CPU percentage, memory percentage, and the specific command that initiated the process.
Key Advantages Over the Traditional top Command
While top is available on almost every Unix-like system
by default, htop offers several quality-of-life
improvements that make it the preferred choice for modern
administrators:
- Horizontal and Vertical Scrolling: You can scroll through the entire process list vertically and view full command strings horizontally using the arrow keys.
- Mouse Support: You can click on menu items and sort columns directly with your mouse.
- No PID Typing: Instead of typing a process ID to kill or reprioritize a task, you can simply navigate to it using your keyboard or mouse.
Essential Shortcuts for Process Management
The footer of the htop interface maps out the functional
Fn keys, which allow you to interact with your system dynamically
without leaving the tool. Here are the most crucial shortcuts to
know:
- F3 (Search): Type to find a specific process by name.
- F4 (Filter): Hide everything except processes matching your search term.
- F5 (Tree View): Organize processes by their parent-child relationships to see what triggered a specific task.
- F6 (Sort): Sort the process list by criteria like CPU%, MEM%, or Owner.
- F7 and F8 (Nice value): Lower (F7) or raise (F8) the priority of the selected process.
- F9 (Kill): Send a signal (such as SIGTERM or SIGKILL) to terminate the selected process safely.
Customizing your Display
By pressing F2 (Setup), you can access the configuration menu. This allows you to customize the meters at the top of the screen, change the color scheme, add or remove columns from the process list, and toggle features like showing hostnames or displaying data as text instead of graphical bars.
For more advanced guides, troubleshooting tips, and deeper dives into performance monitoring tools, you can find a collection of resources at https://salivity.github.io/htop.