top vs htop: What's the Difference?
top and htop are two of the most popular command line utilities for system monitoring in Linux.
They have similar names and similar objectives.
So, what's the difference between the two?
Difference between top and htop
top is the older command and it comes preinstalled on all Linux distros. htop is newer and it adds color and gives a more interactive user interface than top. In other words, htop provides a slightly better user experience, but it's not a standard command you'll find on all Linux systems.
But before you jump to the details, here is a quick summary:
top | htop | |
---|---|---|
Installation | Comes pre-installed in every modern UNIX-like OS. | Needs manual installation. |
Focus | Puts more emphasis on showing processes that consume the most system resources. | While htop tries to show every ongoing process. |
Scrolling support | No. | Allows horizontal and vertical scrolling. |
Process tree | It does not show the process tree. | You can press F5 and it will show ongoing processes in tree format. |
Mouse support | No. | Yes. |
User interface | Plain text and uses bold text to highlight information. | Has a beautiful colored interface. |
Release | 1984, authored by William LeFebvre. | 2004, authored by Hisham Muhammad. |
Let me start with the most noticeable change. You guessed it right, its visual appearance.
Visual appearance
This is how the top command looks like in the default settings:
Nothing fancy. It shows relevant info in bold and I changed the bold color to light green for better readability.
On the other hand, the htop is completely different:
And here you have various advantages over the top utility as it shows the following details by default:
- How every core of your processor is utilized with individual progress bars.
- Beautiful colored output.
- Ability to use the mouse pointer to select options with the ability to scroll through the processes.
Availability
You will find the presence of top and htop in the default repository of almost every repository.
But the top
comes pre-installed with every modern UNIX-like system whereas the htop
does not come pre-installed in the majority of systems.
So you will have to follow manual installation to get your hands on the
Features
As the top has been around since 1984 (even before Linux was introduced), it only comes with basic features and is still in active development.
While htop made its debut in 2004, you are expected to have more features.
So let's have a look at what are those features that are lacking in the top utility and are available in htop:
- List ongoing processes in a tree manner.
- Ability to kill any process with ease (using
F9
). - Filter processes.
- More configuration options.
- Known for being faster than the top.
- By default shows relevant details such as how each core is being utilized.
Bonus: If you still insist on using top
Here is a neat trick to make the top utility colorful and will also show some additional information.
You just have to press 1
, z
, c
and m
one by one while using the top utility and the end result would look like this:
Look way better than the default one.
Wrapping Up
This was my take on the difference between top and htop and I would go for htop over top any day. But that's my personal preference. And at the end of the day, it does come to what you prefer, top or htop.