htop
is a process viewer that lets the user monitor and manage the processes running in Unix and Unix-based environments. It is an alternative to the program called top, but htop
is better off regarding process viewing flexibility and with features of additional manipulation.
htop
provides a cleaner and colorful interface with horizontal and vertical scrolling support.
This tutorial will guide you with the steps of installing htop
in Linux with the following methods.
- Installing Htop Using Apt in Debian
- Installing Htop Using Snap
- Installing Htop in CentOS/Red Hat Enterprise Linux
- Installing Htop From Source Package
Table of Contents
Install Htop Using Apt in Ubuntu/Debian-based Distros
This method works for the Debian distribution and all the Debian-based distributions like Ubuntu, Linux Mint, etc.
The initial step is to update the system with the following commands.
sudo apt-get update && apt-get upgrade
Before installing the package, it is good to view the various information about it. You can use the command below to view the information about the htop package.
apt show htop
The command will output the following result.
Package: htop Version: 3.2.1-1 Priority: optional Section: utils Maintainer: Daniel Lange <[email protected]> Installed-Size: 387 kB Depends: libc6 (>= 2.33), libncursesw6 (>= 6), libnl-3-200 (>= 3.2.7), libnl-genl-3-200 (>= 3.2.7), libtinfo6 (>= 6) Suggests: lm-sensors, lsof, strace Homepage: https://htop.dev/ Tag: admin::monitoring, interface::text-mode, role::program, scope::utility, uitoolkit::ncurses, use::monitor, works-with::software:running Download-Size: 154 kB APT-Sources: http://http.kali.org/kali kali-rolling/main amd64 Packages Description: interactive processes viewer Htop is an ncursed-based process viewer similar to top, but it allows one to scroll the list vertically and horizontally to see all processes and their full command lines. . Tasks related to processes (killing, renicing) can be done without entering their PIDs.
The next step is to install the htop package.
sudo apt-get install htop
The package will be installed, and you can access htop
as follows.
htop
Sometimes, while installing a package, there is a chance that you might not know the exact name of the package. In such a case, you can use the apt-cache
search to find the package’s exact name. Write the keyword you want to search for after the command.
apt-cache search htop
The output looks like this.
htop - interactive processes viewer
Thus, we can find the package name from its function beside it.
Install Htop Using Snap
Snap eases the installation of htop regardless of the Linux distributions. You can use snap to install htop in various distributions like Arch Linux, Cent OS, Debian, Fedora; you name it. First of all, make sure that snap is installed in your system. For Debian, you can install it via the following commands.
sudo apt update sudo apt install snapd sudo snap install core
Use the snap search command as follows to find the htop
package.
snap search htop
The command gives the following output.
htop 3.2.1 maxiberta - Interactive processes viewer
Installing packages from snap has never been so easy. To install htop
, use the following command.
sudo snap install htop
The output shows htop has been installed successfully.
htop 3.2.1 from Maximiliano Bertacchini (maxiberta) installed
For further verification of the installation, use the following command and locate htop in the list.
snap list
Next, type htop
in the search bar. htop
will appear, and press enter
to run it. Then, a new terminal will open up with htop
.
Install Htop in CentOS/Red Hat Enterprise Linux
The software packages can be installed from the EPEL repositories for CentOS/ Red Hat Enterprise Linux(RHEL) distributions. Htop is also available in the EPEL repositories. To install it, ensure you have EPEL repos installed in your system. To install it, if you have not, use the following command.
yum install epel-release
Next, use the yum command to install htop as follows.
yum install htop
This installs htop in CentOS/RHEL distributions.
Install Htop From Source Package
Let’s suppose the latest build of htop has been released, but it is not available for your distribution yet. Or, the htop package is not available for your distribution. But you still want to use the latest build. In such a case, you can install htop from the source package.
Source packages are different from binary packages. Since they are not pre-compiled, users need to compile them. Additionally, the software installed from the source package is not stable compared to binary packages.
First, download the htop source package. A file htop-3.2.1.tar.xz will be downloaded. Next, locate the downloaded directory and extract the archive file with the following command.
tar -xf htop-3.2.1.tar.xz
Next, navigate to the htop-3.2.1 directory. Make sure to use the correct filename/directory name as the one used here will probably differ from yours.
cd htop-3.2.1
The next step is to compile the source. For that, you need to use the two tools, configure and make. The configure file is a POSIX shell script that ensures whether the software can be installed in the destination system.
Execute the configure file as follows.
./configure
The output looks like this.
htop 3.2.1 platform: linux os-release file: /etc/os-release (Linux) proc directory: /proc (Linux) openvz: no (Linux) vserver: no (Linux) ancient vserver: no (Linux) delay accounting: no (Linux) sensors: no (Linux) capabilities: no unicode: yes affinity: yes unwind: no hwloc: no debug: no static: no
The above command builds a file called Makefile
. Now, use the make command to build from the Makefile
and install the package.
make sudo make install
Now, you can run htop
from the terminal.
Conclusion
htop
is an interactive processes viewer, an advanced substitute for the standard top package in the Unix system.
This tutorial taught you how to install htop
in your Linux system using several methods. The tutorial covered the installation of htop
using apt
, snap
, yum
and source packages across the different Linux distributions.