Installing Htop on Linux: A Comprehensive Guide (2023)

The htop command on Linux is one of the most useful ones on the operating system to date. It is a very advanced process manager application.

It is available on various operating systems, barring Windows and all Linux distributions. It is better than task managers which are present on Windows or ones that are present on ‘ready-to-use’ distros like Linux Mint. This is due to the fact that it runs on the command line.

It was built as a successor to the popular top command on Linux. It has a lot of features which are also present in the top but also possesses a host of advantages which include the following:

  • Being able to show all the processes running on the system instead of only the most intensive ones
  • Being able to terminate processes without requiring the use of PIDs (Process Identification Number)
  • It is able to represent different processes and system usage using different colors
  • Having a much more readable user interface
  • It can sort different processes using the ‘F’ series keys
  • It is able to view processes as a tree

We are going to look at the different ways to install htop on your computer.

Htop is an advanced command-line-based process manager application compatible with several operating systems, barring Windows and some Linux distributions. Its robustness and utility surpass many standard task managers by offering features like process termination without PIDs, a color-coded interface, and process tree view, among others. This article details different ways to install and use Htop on your Linux system

Installing Htop via Default Package Manager

The easiest way to install Htop on your Linux system is to just use the terminal. The package manager which your distro uses will probably have maintained a version of htop in their repositories. My distro uses the synaptic package manager, and thus I will be utilizing it to download htop.

$ sudo apt install htop

After entering your password, the package manager would install the required files on your system

Htop Install
Launching Htop via Terminal

From here on out, you can just type htop in the terminal to use it.

$ htop
Htop Running
Htop Running

Compiling and Installing Htop from Source Code

In order to compile htop from source, we need download some development tools as well as ncurses. It is also important to compile the package from the official website, and perform the installation in the following steps

Installing the Development Tools:

Type in the following in the terminal to download the development tools

$ sudo apt install build-essential
Installing Development Tools
Installing Development Tools

Install ncurses using the following command:

$ sudo apt install libncurses5-dev libncursesw5-dev
Installing Ncurses
Installing Ncurses

Lastly, to get Htop from the source from hisham.hm :

You can obtain the file for the installation of htop from the following link:- http://hisham.hm/htop/releases/2.2.0/htop-2.2.0.tar.gz

Or, you can use the wget command to get the file:

$ wget http://hisham.hm/htop/releases/2.2.0/htop-2.2.0.tar.gz
Downloading Htop From Source
Downloading Htop From Source

We need to extract the contents of the tar file, It is extremely simple to do so.

$ tar xvfvz htop-2.2.0.tar.gz
Extracting Tar File
Extracting Tar File

After extraction, we need to go to the extracted folder in order to configure the installation

$ cd htop-2.2.0/
Changing Directory
Changing Directory

Then we can go the .configure to “make” the installation.

$ ./configure
Going To .configure
Going To .configure

After this, we type in the following command to make a script:

$ make
Using The Make Command
Using The Make Command

And lastly, we type in the command to install htop:

$ make install
Using The Make Install Command
Using The Make Install Command

Before running the ‘htop’ command to begin using our new system process manager, we need to apply a few updates. This version of htop is a deprecated version and thus needs a few updates from the package manager in order to get working again

Cloning and Installing Htop from GitHub Repository

It is also possible to do this same process but using the new GitHub repositories which are now used to maintain htop. You have to follow the same steps, download the latest tar file of htop, extract it, configure it, and make install

This will finally lead to you running htop on your distro!

Htop Running 1
Htop Running

Summary

In this guide, we’ve examined various techniques to install Htop on your Linux system, including through the synaptic package manager, tar files, and the official GitHub repository. Although Htop comes highly recommended for process management, the final choice will always be user-dependent. As you navigate your way around the Htop command, remember that learning is the real journey. What other command-line tools do you use to manage your system?