The htop is a command-line utility that allows you to interactively monitor your system’s vital resources or server processes in real-time. In this guide, we will cover how you can use this command and briefly explain its different sections one by one.
How to Monitor System Processes Using htop Command
Step 1: Connect Your Server with SSH
You need to connect your server through an SSH connection. Instructions can be found here.
Step 2: Using htop Command Under SSH Terminal
Once your server is connected with SSH, you can run the htop command by just typing the htop and press Enter. A screen will open up as a result of this command and will look like the below screenshot.
The whole window above can be split up into three sections for the ease of our understanding. The top-left section comprises the CPU and memory usage information. The top-right section provides info about load average and uptime. The rest of the information contains real-time data of processes with stats like priority, CPU and memory consumption, etc.
We will cover these sections one by one.
Starting from the top left, there is a CPU line that shows the percentage of CPU being used. For a single-core CPU, there will be one line for it. In the case of multi-core CPUs, there will be n number of lines depending on the number of CPU cores. In any case, if the CPU percentage is near 0 marks then it means the CPU is not having much load and if it approaches 100 for a long time, it means the CPU is under load.
Color coding of CPU usage lines:The lines indicating CPU and Memory usage have a color-coding of CPU.
Following colors indicate the type of process:
Red = Kernel process
Green = Normal user process
Blue = Low priority process
The next line denotes memory being consumed by the process running on the server, this is denoted by the number of memory used out of total memory.
Color coding of Memory usage lines:
Green: Used memory pages
Blue: Buffer pages
Yellow: Cache pages
It is the average of computational work performed by the CPU. 1.0 on a single core CPU would mean 100 percent utilization, similarly, 2.0 on a dual-core CPU represents 100% CPU usage.
The load average contains three values. The first number is a minute average(0.00 in the figure above), the second number is 5 minutes average (0.01 in the above figure) while the third number is fifteen minutes average (0.05 in the figure).
The information below shows the information about processes running on your server.
As shown in the above figure the following words denote:
PID: Unique Process ID.
USER: Process Owner.
VIRT: Virtual memory being consumed by the process
%CPU: The percentage of the processor time used by the process.
%MEM: The percentage of physical RAM used by the process.
COMMAND: The name of the command that started the process.
The htop footer contains its menu command.
These commands can be used to do various functions for e.g. F6 Sort By can be used to sort the process via CPU usage and memory usage.
In a nutshell, htop is a useful command-line tool in the Linux environment to determine the cause of load by each process. It is similar to Task Manager in the Windows OS environment. It can be used to troubleshoot and kill a process that is utilizing excessive server resources.
That’s it! We hope this article was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.
Use our WordPress hosting to monitor and use System Processes easily using HTOP as well as other commands.