Ever wondered what all the red, green, orange, aqua and dark blue bars mean in htop? Even if you are not familiar with htop, this article will introduce you to the great Linux task manager and it’s color key.
If you haven’t got htop installed yet, you can install itat the terminal prompt, by using apt or yum:
To install htop on your Debian/Apt based Linux distribution (Like Ubuntu and Mint), do:
sudo apt install htop
To install htop on your RedHat/Yum based Linux distribution (Like RedHat and Fedora), do:
sudo yum install htop
htop – the Great Linux Task Manager
Many users are familiar with the Windows task manager. That handy little utility which lets you kill processes when they are hanging and have a quick glance on how your system is doing hardware wise.
But what we can use in Linux? While some different flavors of Linux may come with their own task manager (like System Monitor in Ubuntu), such tools may not be universal. They may also lack features and be unusable from the command line.
Welcome to htop, the terminal based, full fledged task manager which can also be started in various distributions directly from the Desktop, bypassing the need to use a terminal.
htop allows you to browse through processes running on the system, sort them in various ways (try clicking one of the headers to sort by that column, and click it again to reverse sort), to kill processes when needed using a variety of kill signals (to do so, select a process to kill, press F9 and select a kill signal), and a variety of other monitoring and process management features.
What’s Up With All the Colors?
So far we only had a peek at the bottom part of the htop GUI: the processlist and htop features to manage each process. However, the top part of the htop GUI is where all that information is combined, and where we can monitor how well our hardware is performing.
If you like to learn more about how to interpret this output, you can review our Is Your Linux System Memory, CPU or IO Bound? article.
Looking at the bars and statistics for memory (Mem), swap (Swp) and CPU threads (1 bar per thread), we quickly see that a large variety of colors is used to provide more detailed information about each component and it’s status bar. We see red, green, orange, dark blue and potentially aqua, and there also some offset between bars of different types. For example, the memory bar has orange whereas the CPU threads do not.
All of these colors look much better then the alternative: htop without color coding:
You can start htop in monochrome mode by invoking
htop -C (uppercase C required, lowercase will not work) at the command line.
Putting monochrome output on the side and returning to our more pleasant colorful and default htop output, what do each of the colors signify?
The Color Key
The htop color key may seem hard to find! If we access the htop manual (
man htop) there is no information on colors, other then how to disable them using the
-C option discussed earlier. The answer is to press the F1 key which will lead us to a small help screen with the color key as well as some handy keyboard shortcuts:
For the CPU threads usage Bar, the dark blue bars are low-priority processes, the green bars are normal processes, the red bars are kernel time and (though you may not see this), the aqua colored bars are virtualized processes, when present.
A full CPU thread usage bar will be made up out of most of these types of processes – after all, your kernel is always running etc.
Next we can see the Memory (Mem) bar – made up out of green, dark blue and orange bars.
The green bars indicate what memory is used, the blue bars show us how much was allocated to buffers and finally the orange bars shows the amount of memory allocated to cache. It should be noted that buffer and cache memory can, in part, be considered available memory (type
free -g at the command line for a more detailed analysis output, or
free -m if your system has less then 2-3 Gigabyte total memory).
Finally, the swap bar has only a single bar color, red, indicating how much of the swap file, or swap partition is in use.
Knowing what colors are used by htop enables one to better understand the rich information htop is providing. This information can often be obtained with in a simple glance at htop output. Enjoy finding out more about your desktop computer or server through htop!