htop: An Interactive Process Viewer


preview imageDevOps
by Anurag Srivastava,Oct 13, 2018, 8:49:59 PM | 2 minutes |

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:

htop


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:



We can kill the process by hitting enter button.

This is a nice tool which gives us a clean colorful view using which we can easily understand what is happening. In top command we have no option to kill the process unless we pass the process id to the kill command but in htop we can do lot of things from a single screen, also the shortcuts are quite handy and increases the productivity. In case of any suggestion or query please do comment.


Comments (0)

Leave a comment

Related Blogs

preview thumbnail
Introduction to Logstash

Dec 20, 2019, 11:38:31 AM | Anurag Srivastava

preview thumbnail
Importing MongoDB data into Elasticsearch

Mar 9, 2019, 8:20:38 AM | Anurag Srivastava

preview thumbnail
Importing MySQL data into Elasticsearch

Feb 9, 2019, 12:06:18 PM | Anurag Srivastava

preview thumbnail
Snapshot and Restore Elasticsearch Indices

Sep 16, 2019, 5:55:06 AM | Anurag Srivastava

preview thumbnail
Log analysis with Elastic stack

Jan 31, 2018, 6:11:29 AM | Anurag Srivastava

preview thumbnail
Creating Elasticsearch Cluster

Apr 6, 2019, 8:41:41 PM | Anurag Srivastava

Top Blogs

preview thumbnail
Configure SonarQube Scanner with Jenkins

Jun 21, 2018, 4:58:11 AM | Anurag Srivastava

preview thumbnail
Execute Commands on Remote Machines using sshpass

Jul 16, 2018, 5:00:02 PM | Anurag Srivastava

preview thumbnail
Importing MongoDB data into Elasticsearch

Mar 9, 2019, 8:20:38 AM | Anurag Srivastava

preview thumbnail
Importing MySQL data into Elasticsearch

Feb 9, 2019, 12:06:18 PM | Anurag Srivastava

preview thumbnail
Configure Jenkins for Automated Code Deployment

Jun 13, 2018, 3:44:01 PM | Anurag Srivastava

preview thumbnail
Deploying Angular code using Python script

Jun 26, 2018, 4:50:18 PM | Anurag Srivastava