I have probably been entertaining the idea of replacing
top with htop for quite a few years now. I have even made the attempt a few times. Familiarity and muscle memory always brought me back to
top. Until now.
Some advantages of htop
The biggest advantage of htop for me is that it combines the functionality of
top and iotop into a single screen, since iotop lets you add disk I/O columns to the output. This feature has saved me quite a bit of time and thought. I don’t have to crossireference processes between
top and iotop now, and I also don’t have to fire up
vmstat as often as I used to.
You can also highlight a process and hit
l to get a list of open files for that process. I haven’t needed to use
lsof very often since I learned about this feature.
There are some other small advantages to htop. You can scroll the display horizontally with your mouse, which makes it easy to see the entire command line of a command. You can also select multiple processes to kill or renice.
htop also lets you configure the header area and which columns are displayed in a much more visual manner than
Some minor problems with htop
I’m not really a fan of htop’s color schemes. It ships with a half dozen color schemes that are all either very colorful or completely monochromatic. The color schemes are hard coded, so there is no easy way to define your own.
top compatibile keys for sorting by memory and CPU usage, but there is no key to sort by I/O. To do that you have to hit
> and use the arrow keys to select the I/O column. This is still better than reaching for iotop, but it isn’t exactly ideal. Setting CPU affinity has the same problem.