Open In App

Using htop to Monitor System Processes on Linux

htop a Linux tool that is used in process-managing and terminal-based system monitoring. It allows real-time monitoring of processes and performs every task to monitor the process in the Linux system. The tool is written in the C programming language by Hisham Muhammad. It displays a complete list of processes running on the system and gives information on CPU use, memory and Processor. With the help of htop, we can sort the processes depending on CPU, memory use, and processes run by the user. There are various commands and options available for the htop command

Installation

$ sudo apt-get install htop
sudo dnf install htop
brew install htop

To install the latest version of htop you can download the tarball file from here. To extract the tarball file use the command, htop.tar.gz is the name of the file you download.



tar -zxvf htop.tar.gz

Go to the extracted htop directory using cd.

cd htop

To compile htop execute these commands



./configure
make
sudo make install

Getting Started with htop

After we’re done with the installation of htop tool, we can now launch it by entering htop command in the terminal.

 In the topmost left corner, CPU usage is depicted by percentages using different color bars for different types of processes, and the core of the CPU is denoted by the number of bars. Two Modes of CPU Metric are

Color denotation for Default Mode is given in the following:

Memory Usage and Swap are present below the CPU Usage bars. It displays the amount of memory consumed by processes. 

Swap Usage of System

Tasks, Threads, Running Processes, Load Average, and Uptime are shown in the system which is present next to the color bars.

Tasks – Shows the number of open processes present in the system. Here it displays  3 values that include the total number of tasks (77), the number of threads (147 threads), and the number of tasks currently running (1 running).

Load Average – Shows the average load of the system by CPU. Three average load numbers are displayed: Average load of system for last 1 minute  (0.13), average load of the system for last 5 minutes (0.49), average load of system for last 15 minutes (0.57) 

Uptime – Total system uptime from the last reboot.

Htop Menu

Customizations are done in htop setup menu and to access the menu press F2. There are four categories where you can customize the top menu: Setup, Left Column, Right Column, and Available Meters. They are used to configure meters, set display options, set color patterns and choose the columns to print them in order.

Display Options

Customizing display using htop command by pressing F2 and then navigate to display options. In the settings we have chosen highlight new and old processes where it’ll separate all the old and new processes and display them. 

By navigating to the display column we can change the display options for htop terminal, here we have changes the color of the terminal to black night.

Using htop commands

On htop, you can scroll horizontally and vertically with the help of “Up and Down” and “Left and Right” keys to scroll through processes. 

Note: Press space bar to untag specific tagged process and press U to untag all tagged processes

For PERCENT_MEM sorting, choose the option and hit enter.

To check what other shortcuts are available for the htop command, then you can press F1 key, then a list of key options will be displayed. 

Article Tags :