How to Manage Processes Efficiently in Linux

While using a GUI to manage our tasks has been the norm over the years, using the command line can give the impression that it would be more complicated. However, the contrary is true. Many feel that some tasks are easier and can be done more efficiently on a command line. You might be used to the ubiquitous Task Manager on Windows, where you just press “Ctrl+Alt+Delete” (or “Ctrl+Shift+Escape”), and you get a list of all processes neatly organized in tabs.

While it might not be as simple as a point-and-click system in Linux, you have an extremely powerful task manager called “htop” instead. Once you get past the small learning curve, you’ll feel much more at home with the command line tool, and it might even be faster compared to its GUI counterpart. In this tutorial, we will go over the limitations with the pre-installed task manager, as well as cover how to install a more powerful alternative called htop, along with a short guide on how to use it.

In this tutorial, we will be installing htop on a CentOS VPS.

The Problem with “top”

Linux already comes pre-installed with its own task manager, called “top”. While it will suffice for seeing an overview of tasks, there are a lot of limitations. Here’s a sample output:

Output of Top
The Output that Top Gives

As you can see, it gives you a bunch of information about each process, such as the amount of memory it’s currently using, the percentage of CPU being used, the amount of time that the process has been running, and so on. However, this is just “viewable” information. You can’t do anything with the tasks, like killing them for example.

Luckily, we can install an extremely useful package called “htop”, which is a lot more powerful than “top”. Here’s how to install it, and a short guide on how to use it.

Installing and Using htop

If you’re using a RedHat-based distribution like CentOS, you first need to download and install the EPEL repository. This is an extended library of approved packages containing a lot of useful packages not included with the base version of CentOS.

To do this, type the following:

<span class="s1">yum install epel-release</span>

This will download and install the “Extra Packages for Enterprise Linux” bundle which will make htop available for download, along with many other software packages. Once EPEL is installed, you can obtain the htop package like this:

<span class="s1">yum install htop</span>

This will display package information and prompt you to accept, like this:

Installing HTOP on Linux
Installing htop on Linux

Once it’s installed, it’s time to see what htop can do as a task manager.

Killing Processes Using htop

To start using htop, simply type:

<span class="s1">htop</span>

This will bring up all of the “tasks” running on the system just like with the “top” command. In this example, I’ve created a “sleep” process for 30 minutes and pushed it into the background, as shown here:

Killing Sleep Process in htop
Killing Sleep Process using htop

As you can see, htop displays the list of processes including “sleep”. At the bottom, we have a list of useful shortcut keys that tell you what you can do with each function key. As shown, the function key “F9” kills the process. So just use the arrow keys to move the line over the process you want, and then press F9 to kill the process.

This will bring up a new screen where it asks you for the kind of signal you want to send. Like this:

Choosing Signal to Send to Process
Choosing the Signal to Send to the Process

Each of these signals has a different meaning. For example, if you want to ask the program to quit in a controlled fashion, scroll to the “SIGINT” signal and press enter. If a process seems to be misbehaving, you can force it to close using the “SIGKILL” signal.

Note: Use SIGKILL sparingly, and only when you have to. Always give a process an opportunity to exit gracefully, otherwise, you risk losing data, or experiencing data corruption.

Sending a signal to terminate will remove the process immediately from the list. Unlike with Windows, you won’t receive any warning. So make sure to double-check which program you’re killing before doing so forcefully.

Additional Functions of htop

We can use htop for so much more than just killing tasks. Using it, you can sort by columns, filter the processes that you want to see, and even arrange, as well as show or hide the columns that you want to see. In addition, you can also increase and decrease the priority of various tasks by adjusting the “Nice” value incrementally with “+” or “-“.

With htop, you don’t need any other process manager, and once you familiarize yourself with it, it’ll be easy to see that it’s also significantly faster and more efficient compared to what you might be used to with Windows. 


Of course, you don’t need to manage your processes yourself if you have a CentOS VPS hosted with us, in which case our expert sysadmins will install htop or manage your processes for you. They are available 24×7 and can help you with any questions or issues that you may have.

PS. If you enjoyed reading this blog post on how to manage your processes in Linux, feel free to share it on social networks using the share shortcuts, or simply leave a comment in the comments section. Thanks.

Leave a Comment