Install HTop on Ubuntu

28/12/2020
htop is a system monitoring utility that runs on the terminal. It is similar to another commonly used utility called top. But htop is much easier to use. htop program’s user interface is ncurses based and the information representation is really clean and nice. That’s why many people, including myself like htop. You can also filter, manage and do other cool stuff on the running processes with htop utility. It is a great tool for Linux system administrators.

In this article, I will show you how to install htop on Ubuntu 17.10 Artful Aardvark and how to use htop. Let’s get started.

Installing htop

First update the package repository cache of your Ubuntu operating system with the following command:

$ sudo apt-get update

The package repository cache should be updated.

htop is available on the official package repository of Ubuntu 17.10 Artful Aardvark. To install htop, run the following command:

$ sudo apt-get install htop

htop should be installed.

Now run the following command to start htop:

$ htop

This is the main window of htop.

Basics of htop

Now I am going to talk about the interface of htop program.

On the marked section in the screenshot below, you can see the uptime of your computer. As you can see, my computer is running for 2 hours 41 minutes and 58 seconds.

You can find how much of the CPU is used in the marked section in the screenshot below. As you can see I have 2 cores in my processor and only 0.7% out of 100% of each is used.

In the marked section in the screenshot below, you can find how much main memory or RAM is available and how much is used. You can also find out how much Swap space is available and how much of it is used.

As you can see, I have 2.91 GB or RAM available and 1.67 GB is used. I also have 947 MB of swap space available and 0 KB is used. Note that, the more swap is used, the more you should be worried. If more swap is used, you should upgrade your main memory or RAM.

Search for Process

You can search for a specific process with htop. For example, let’s say you want to search for the process ‘firefox’.

First start htop and press <F3>. A search box should appear as shown in the screenshot below.

Now type in ‘firefox’, and you should see firefox process selected as shown in the screenshot below. You can see that the process id (PID) is 2240 and the process is owned by USER shovon.

To go to the next firefox process or search result, press <F3> again.

Once you find the process you’re looking for, press <Enter> to select it.

Kill a Process

You can also kill a process with htop utility.

First select a process using the <Up> and <Down> arrow keys or by searching for a process using <F3>.

Let’s say PID 2240 is the process I want to kill. I selected the process as you can see in the screenshot below.

Now to kill the process, press <F9>. You should see the following window as shown in the screenshot below. In the marked section, there are different Linux signals listed. These signals are used to manage Linux processes. To kill a process, the default signal for htop is SIGTERM. You can of course choose any other signals using the <Up> and <Down> arrow keys.

Once you select the signal you want to send to the process, press <Enter>. I suggest you send the default signal SIGTERM if you don’t know what to do here.

The process should be killed as shown in the screenshot below.

Switching to Tree View

The default view mode of htop is Sorted.

You can switch to Tree view if you want by pressing <F5> as shown in the screenshot below.

You can go back to Sorted view again by pressing <F5>.

Customizing htop Window

You can press <F2> to go to htop configuration window as you can see from the screenshot below.

From here you can customize the main window of htop. For example, you can hide or show things, change colors and many more. It is out of the scope of this article. But it should be easy enough to figure out on your own.

Once you’re done, you can exit out of htop window using the ‘q’ key.

That’s how you install and use htop on Ubuntu 17.10 Artful Aardvark. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

How to install LibreOffice 5.4.0 Released on Ubuntu

LibreOffice 5.4.0 had just been released as the last major release of the LibreOffice 5.x family, and its available for install...
12/02/2020

How to install Grub Customizer on Ubuntu 17.04 Zesty

Grub Customizer is a graphical user interface that allows you to name and configure the GRUB2/BURG boot entry settings as...
12/02/2020

Upgrade to Ubuntu 17.10 from 17.04 or 16.04

This article demonstrates how to upgrade to Ubuntu 17.10. Existing users can upgrade either from Ubuntu 16.04 or 17.04. An...
12/02/2020