Htop Is Better Than Top



Most users of Linux are familiar with top, a process viewer that displays Linux tasks in console providing a real-time view of the running system. It shows a lot of information that can be useful when trying to build a lightweight system using some standard distribution instead of a lightweight distribution. Unfortunately, top is not very pleasant to look at, and it lacks some useful functionalities.

This is where htop shines. As you can see, it uses colors and thus provides a lot nicer view than top. Htop also shows CPU and memory usages as bars rather than percentages. In addition, its keyboard shortcuts are clearly shown in the bottom line. There are keyboard shortcuts for e.g. searching, organizing the view as a tree, changing the niceness of processes and even killing them.


Htop is certainly available for your distribution, be it Debian, Ubuntu, openSUSE or any other distribution. Give it a try, you won't look back to top!

2 comments:

Bruno Bernardino said...

Hey there

I've used htop for a while now, but only on debian.

Currently I've installed it on gentoo, and the free memory it shows is very different from what top or free shows...

imagine that sometimes top may be showing 100MB free and htop can be showing 600 or 700MB free

Any idea why this is happening!?

Mikko said...

Not really. This is what I found in the htop FAQ:

The memory meter in htop says a low number, such as 9%, when top shows something like 90%! (Or: the MEM% number is low, but the bar looks almost full. What's going on?)

The number showed by the memory meter is the total memory used by processes. The additional available memory is used by the Linux kernel for buffering and disk cache, so in total almost the entire memory is in use by the kernel. I believe the number displayed by htop is a more meaningful metric of resources used: the number corresponds to the green bars; the blue and brown bars correspond to buffers and cache, respectively (as explained in the Help screen accessible through the F1 key). Numeric data about these is also available when configuring the memory meter to display as text (in the Setup screen, F2).