htop is an interactive version of top command which we use to get the process listing. top command is quite popular and most of the users run this command to get the running process details and their impact on system performance. This command is quite useful in order to know the process which is consuming excess CPU or memory. In this blog I will cover htop tool which provides an interactive and more intuitive view of traditional top command. It is a system monitoring tool which we can run from the terminal after installing it on the machine. So lets start this by installing the htop tool.
Before installing the htop tool we need to update the apt repository on Ubuntu:
sudo apt-get update
After updating the Ubuntu apt repository we can install htop by executing following command:
sudo apt-get install htop
After successful installation of htop we can execute htop by executing following command:
This will open following screen:
In the above screen-shot we can see two sections. On left side of the top section, we can see the CPU usage and memory usage. On the right side we can see total tasks, load average and uptime etc. Below this we have the tabular data display where we can see process id, user, cpu, memory usage and actual command which was executed. On the bottom we have shortcuts using which we can perform various tasks like search, filter, sort, kill etc.
We can kill any process by moving the cursor on the process using up and down arrow. Once the cursor reaches on the process we can click on 'F9' key. This will ask for confirmation where we can press on enter button to kill the process or can press on esc button to cancel the kill process. Below screen-shot displays the confirmation option which appears on bottom: