What is htop and How Do You Use It?
This article provides a general overview of htop, an
interactive system monitor and process viewer for Unix-like systems. You
will learn about its key features, how it improves upon the traditional
top command, and how to navigate its interface to manage
system resources effectively. By the end of this guide, you will
understand how to monitor CPU, memory, and running processes using this
powerful command-line tool.
Overview of htop
htop is a popular, text-based process viewer that allows users to monitor their system’s vital statistics in real time. Unlike older utilities, htop provides a full, colorized overview of system performance right in the terminal. It is widely praised by system administrators and developers for its responsiveness and ease of use.
The tool offers several advantages over the classic top
command:
- Mouse Support: You can use your mouse to click on menu items, select processes, and sort columns.
- Vertical and Horizontal Scrolling: You can view the full command lines of processes and scroll through the entire list smoothly.
- Easy Killing: You can signal or terminate a process without needing to manually type its Process ID (PID).
- Visual Appeal: Colors quickly indicate CPU core usage, memory consumption, and swap space.
Key Features and Interface
When you launch htop, the interface is divided into three main sections:
- The Header: This area displays live graphs for each CPU core, memory usage, and swap space. It also shows system uptime and the current load average.
- The Process List: The main body of the window lists all active processes. Columns display crucial data such as the PID, user, priority, virtual/resident memory usage, CPU percentage, and the specific command running the process.
- The Function Bar: Located at the very bottom, this menu maps your keyboard’s function keys (F1 through F10) to common actions like searching, filtering, sorting, and killing processes.
Basic Navigation and Shortcuts
Navigating htop is straightforward. You can use the Up and Down arrow keys to scroll through processes. To manage these processes, you can utilize the following essential keyboard shortcuts:
- F3 (Search): Type a name to locate a specific process.
- F4 (Filter): Hide all processes except those that match your typed keyword.
- F6 (Sort): Change the sorting criteria, allowing you to sort processes by highest CPU usage, memory usage, or runtime.
- F9 (Kill): Send a signal (such as SIGTERM or SIGKILL) to the selected process to close it down cleanly or force a shutdown.
- F10 (Quit): Safely exit the htop utility and return to your standard terminal prompt.
For those interested in exploring advanced configurations, custom display setups, and deep-dive tutorials on maximizing this tool’s potential, you can find a wealth of further articles and guides at https://salivity.github.io/htop.