How to use htop to monitor system processes in Ubuntu 20.04

Most of the Windows users know the basic use of the Task Manager. Task manager is a Windows utility through which users can monitor the currently running processes. Similarly in Ubuntu, the htop utility provides the same functionality with more advanced features. Htop is the improved version of the top command-line utility. Using the htop utility, the user can view the crucial details about the Ubuntu system such as CPU running processes, memory utilization, load average, PID’s, etc.

In this article, we will explain the htop command-line utility and how users can use it to manage or monitor system processes with top on Ubuntu 20.04.

Monitor system processes with htop

Open the terminal application. For this purpose, click on the Activities and search for the terminal in the application search bar and hit ‘Enter’. You can also launch the terminal in a quick way by using keyboard shortcut Ctrl + Alt + t.

Terminal

On Ubuntu 20.04 and most of the latest Ubuntu releases, the htop command-line utility is already installed. However, if it is not installed due to any system problem then you can install this utility on Ubuntu system using the following command:

$ sudo apt install htop

Install htop

In the following output, the htop utility is already installed on the current system:

Htop on Ubuntu

You can see that the below output window has three basic sections, in the top header section displaying the information about CPU, swap memory, load average, uptime, and tasks. The main body section displays the information about the running processes and in the bottom footer section, different menu options are available to perform different functions.

Running processes in htop

Using htop command, you can perform the following actions through pressing functional keys to monitor the system processes:

Sort output

To sort the displaying output, press the ‘F6’ function key from the keyboard. After doing this, the output will be displayed in the following manner:

Sort htop output

Displaying processes in a tree-like format

All the processes in Linux are usually displayed in a hierarchical form in a parent-child relationship. To display this relationship in a tree-like structure you will press the ‘F5’ function key from the keyboard. You will see the following output on your terminal window:

Show processes in tree-view

Search for a specific process

Using htop utility, you can also search for a specific process. For this purpose, press the ‘F3’ key from the keyboard and type the name of the search process in the search prompt that displays at the bottom of the terminal window. The following output will be displayed on your terminal screen:

Search for processes in htop

Filter process

You also filter specific processes by giving their respective path. Use the ‘F4’ function key from the keyboard to filter the processes. After that, you need to enter the path of the required process in the footer section. The following output will be displayed on the terminal:

Filter processes

Kill process

You can kill the unwanted process using the htop utility. You will simply navigate among the process using downward and upward arrows and press ‘F9’ function key or letter ‘k’ from the keyboard and select the action you want to perform. For killing a process, you will select ‘SIGKILL’ action and press ‘Enter’ as follows:

Kill processes in htop

Customize the output window

Using the ‘F2’ function key, you can customize the output window according to your ease. After doing this various options will be available on your terminal to customize the output as follows:

Customize htop output

Get help

If you want to get assistance to know about the use of htop command then you will use the ‘F1’ function key from the keyboard and you will see the following options will be shown on your terminal as follows:

Get help on htop

To explore more about htop command you can visit this page here.

In this article, you have seen how you can visualize the system’s processes using the htop command-line utility on Ubuntu 20.04 system. Using this useful command, you can easily monitor or track system resources and running processes. I hope you liked this useful article.