Imagine you are working on an engine and need to tighten several bolts within a small space. Now, imagine you had the choice between a ratchet and a wrench. Would you rather make 100 quarter-turns? Or 25 full-turns? This is the level of improvement that
htop brings to the table. A well-thought-out, modern interpretation of the
htop is my tool of choice for system analytics and process management.
htop command makes many improvements over the original, the most prominent being in user experience. You can now scroll through the processes, and use point and click functionality. If you want to kill a specific process, scroll down to it and F9 it into oblivion. There is no need to search for the PID or have to use the
kill command. Just point and click.
This command runs on Unix, Linux, and macOS. I used the newly released Fedora 31 distro for this demonstration. To install, just run:
$ sudo dnf install htop
You can see the command output in full in this article's title image, but we will break it down section by section as we go along.
Colors and graphs, oh my!
The first thing to notice is the color inclusion. Color is helpful in identifying specific information and is generally pleasing to the eye. After the chromatic shock, we come to the first graphical representation, which shows us CPU load and memory usage:
Notice the lines of various colors here in rows marked one through four. These rows represent CPU cores. These colors represent the following in the case of CPUs:
- Green: CPU utilization owned by normal users (percentage)
- Blue: CPU utilization by low priority processes
- Orange: CPU utilization by IRQ time
- Red: CPU utilization used by system processes
You will also find Mem(ory) and Sw(a)p. The colors for these sections are Green (Ram utilization by pages in memory) and Blue (RAM utilization by buffer pages).
You may see other colors here as well, but for the purpose of this breakdown we will focus on these. You can find more information online if needed.
Just to the right of the bar graph, you will find the following:
Let's break this down:
- 121 tasks (processes), 1 running
- Load Average: 0.27 0.08 0.02
- Uptime: 00:52:53
Only tasks that are consuming CPU will show as running, otherwise they can be listed as:
Note: You can use Shift+k to see the kernel threads and Shift+h to cycle the thread count on/off, as seen here:
As for the Load average, this is the same as
top. Load average is calculated in three intervals: one minute, five minutes, and 15 minutes. These values refer to the amount of time the system has been active since the last reboot.
You can see the same information by running the
Individual process breakdown
The headers above your process list are as follows, in order of when they appear from left to right:
||Process ID number|
||Priority level by kernel|
||Priority set by user|
||Virtual memory being used|
||Physical memory being used|
||Shared memory being used|
||Time since process started|
||Full command being executed|
For more information on
htop be sure to check the command's help section by pressing F1:
Try it out
htop command is, in my opinion, an actual replacement for
top. I actually have
htop aliased on my systems in place of the standard tool. While I have had a great experience with
htop, I recommend that you not take my word for whether it will work for you. Install it and try it out for yourself.