How to install the htop monitoring process on Debian, Ubuntu or CentOS
If you’ve administered a Linux server, you’ve almost certainly used the program top to monitor system processes. Unfortunately, top is a bit lacking in the user friendliness department.
There’s an excellent alternative available called htop which provides much more information about the processes that are running on your system. Whereas top only shows the processes consuming the most resources, htop is much more verbose, displaying every process currently running. It’s also easier to navigate and view the information provided with both horizontal and vertical scrolling included. Finally, it has a much more pleasant color scheme than the original top program.
Getting Started
To complete this guide, you will need the following:
• 1 Node (Cloud Server or Dedicated Server) running Ubuntu, Debian or CentOS.
• All commands should be run as the root user
Step-by-step guide
Installing htop on CentOS 6/7 requires that you add the Epel repository to your system.
yum install epel-release -y
Now you can run the following command to download and install htop.
yum install htop -y
On Debian and Ubuntu, htop is included in the default repos, and so installing htop requires just one step.
apt-get install htop
Once you have htop installed, you can run it with the following command:
htop
htop will run in a fullscreen ncurses window. There are three separate sections, each with a different category of information.
The top of the window displays information about the current system status, such as the system uptime; current CPU, memory and swap utilization; and the number of tasks that are active.
The bottom of the window shows various commands that you can access using the function keys. You can use these commands to look up help, to filter htop results, and more.
The middle of the window shows the currently running processes. You can switch from the default view to a handy tree view by pressing the ‘t’ key. If you’d like to change the sorting, simply press F6. You will then be presented with a number of values by which you can reorder the list of processes. A common one is CPU%, which will sort the processes by what percentage of the CPU they are using. You can also sort by USER, MEM% and TIME%, among other options.
Conclusion
It’s essential to be able to quickly see what processes are taking up memory. With htop, you have an easy way to quickly view a variety of different kinds of information on running processes and your system as a whole. Experiment to see how you can tweak htop to suit your personal needs. If this guide was helpful to you, kindly share it with others who may also be interested.