Monitoring system processes in Ubuntu using htop.

htop is a process monitoring utility in Ubuntu which is based on the top tool. It shows the usage per CPU in a nice graphical interface along with the memory and swap usages. You will be able to easily and quickly identify and kill high-resource-usage tasks.

We provide short steps which will show you how to install htop.

First, You will need to update the package repository cache of your Ubuntu via the command:

sudo apt-get update

Now you can install htop by running the following simple command:

sudo apt-get install htop

Once installed, type in htop in the terminal in order to start it :

In order to select a process, you can press the up/down buttons. To kill a process just hit the F9 key. To change the priority (third column above), use the F7 and F8 keys ( You would need to be root though )

Uptime :

In the screenshot below, the uptime of your system field is marked. As displayed, the system has been up and running for 8 minutes and 36 seconds.

CPU :

In order to know how much CPU power is used, you can view the marked section in the screenshot below. From what is shown, there are 2 cores in the processor and a mere 2.6% and 0.6% of each is used.

Memory and Swap:

To know how much RAM or main memory is available and the amount used, look up the field in the marked box in the snapshot below. Swap space available amount is also shown in the second line as well as how much of it is used.

From what is depicted, there is 1.67 GB of RAM used and 3.84 GB of RAM available. There is also an amount of 947 MB of swap space that is available of which 0 KB is used. The more swap space there is, the sooner you should invest in more RAM.

You may be interested to read :Ubuntu/Debian monitoring tools guide for system administrators

Process search

It is possible to search for a process in htop. You just need to press <F3>, in which case a search box pops out as shown in the snapshot below :

Now you can type in the process name in the marked box above. This will show the specific process being selected as shown below (here it is firefox for instance). The process id in this case is 4863 and owned by user admin_net2.

The next match can easily be found by hitting <F3> again.

You can select a process by pressing Enter.

Kill a Process

Using htop, it is possible to also kill a process. You just select a process, as shown below. Here we selected the PID 4877.
In order to kill it, just press <F9>.

The window shown below will appear.

As shown in the marked section above, various Linux-processes-managed signals are listed.Now to kill a process, SIGTERM is the right signal to pull off this task. Obviously other signals can also be selected using the <Up> and <Down> arrow keys.

As soon as the signal you want to convey to the process is selected, hit <Enter>. In case you have no idea which signal to choose, just go ahead and select the default signal SIGTERM.

As shown in the screenshot below, the process should then be killed. May his soul be blessed !

Switching to Tree View

htop‘s default view mode is Sorted.

In order to switch to Tree view mode, you just need to press <F5> . This is shown in the snapshot below.

To switch back to the default Sorted view, just press <F5> again.

Customizing htop Window

htop configuration screen can be accessed by pressing <F2> as shown in the snapshot below.


You now have the possibility to customize the htop main window. For instance, you can show or hide items as well as change colors….. As it is intuitive, you can find out by yourself what parameters can be configured as well…

Leave a Reply

avatar
  Subscribe  
Notify of
Close Menu
Show Buttons
Hide Buttons