January 27, 2022

COSFONE

Networking, PBX, IT, DIY Solution

HTOP: How to use this process management tool in Linux server?

4 min read

HTOP: How to use this process management tool in Linux server?

 

HTOP: How to use this process management tool in Linux server?

Let’s introduce a very useful tool to manage check and manage various processes in Linux: Htop.  

You can use this tool to check which process highly occupy CPU and System Memory.

 

Htop command is an enhanced version of top, with richer features, such as user-friendly management of processes, shortcut keys, vertical and horizontal display of processes, etc.

 

The specific advantages are as follows:

  • Compared with the two, top is more cumbersome
  • Default support for mouse operation in graphical interface
  • Scroll through the process list horizontally or vertically to see all processes and the complete command line
  • When killing a process, you do not need to enter the process number, etc.

In this article, let’s take a look at how to install Htop on the server of the pagoda panel to manage the server process.

 


Installation

The general recommendation is yum installation, which can automatically resolve package dependencies, connect to the server through ssh,  install  and run it.

 

Let’s use Centos/Rehat (Rocky Linux or Almalinux)  for example:

  yum install htop -y && htop

 

HTOP: How to use this process management tool in Linux server?

 

If running Debian/Ubuntu, like this

apt install htop -y && htop

 

 


Detailed explanation of the panel of Htop

After the installation is complete, you can directly tap the htop command in the command line to enter the htop interface.

Of course, the pagoda terminal that comes with the pagoda panel 6.X can also call up the htop interface. Knock command:

 

htop

 

The management interface is as follows:

 

 

At a glance, the information you need is all there. Big Bird introduces it here:

 

HTOP: How to use this process management tool in Linux server?

 

The left part, from top to bottom, is the usage of cpu, memory, and swap partition.

The right part is: Tasks is the total number of processes, the number of currently running processes, and Load average is the average load of the system in 1 minute, 5 minutes, and 10 minutes.

In this case, Uptime is the running time of the system.

 

Big Bird’s VPS has two cores, so the panel shows the usage of 1 and 2 cores.

 

Let’s take a look at the description of the detailed list below:

 

HTOP: How to use this process management tool in Linux server?

 

The above items are:

  • PID : the identification number of the process
  • USER : the user running this process
  • PRI : the priority of the process
  • NI : The priority value of the process, the default is 0 , can be adjusted
  • VIRT : The virtual memory value occupied by the process
  • RES : The physical memory value occupied by the process
  • SHR : Shared memory value occupied by the process
  • S : The running status of the process, R means running, S means sleeping, waiting to wake up, Z means dead state
  • % CPU : The CPU usage occupied by the process
  • % MEM : The percentage of physical memory and total memory occupied by the process
  • TIME +: The total CPU time occupied by the process since it was started
  • COMMAND : The name of the startup command that the process started with

Of course, we can also click F1 with the mouse, or type F1 to call up the help interface, as shown in the figure:

 

HTOP: How to use this process management tool in Linux server?

 

Looking at it, you can basically understand it.

 

 


How to use Htop?

With a general understanding of Htop, we can use it, but the most used one is to kill the process, which is very effective for the problem that the load on the panel is always 100%.

 

1. Kill the process

To see how to kill a process, we use the mouse to select a process with a particularly high CPU usage, press F9, or click the following F9 with the mouse, the system will ask to continue or terminate, as shown in the figure:

 

 

After clicking Kill, we will come to this interface as shown in the figure:

 

 

We can kill the docker process by pressing Enter according to the prompt. You can also use ESC to terminate the operation.

 

2. Sorting method

We can press F6 to choose what to sort by, and the most frequently sorted content is cpu and memory! , as shown in the figure:

 

HTOP: How to use this process management tool in Linux server?

 

In this way, it will be sorted according to the occupied size of CPU resources, which is very convenient.

You can also select MEM to sort, or click on the CPU% and MEM% displayed by the green horizontal bar.

These will also be automatically sorted according to the occupied size of cpu or mem. , take a look at the diagram:

 

 

 

3.Select a user’s process

If we need to see the process of the root user, we can do this, directly enter “U” and all users will appear. We can select the root user, as shown in the figure:

 

 

After this selection, the root user will be brightened, and other users will be darkened, isn’t it very convenient.

 

4. Tree structure

We can press F5 to arrange all processes in a tree shape, as shown in the figure:

 

 

You can see the tree-like execution structure of all programs, which is very convenient for system management to clarify how the program is generated. Of course, the browsing of the tree-like structure can also be sorted according to other data.

Of course, if you want to exit the Htop interface, press F10.

 

 


Summary

Htop is mainly used to manage the process of the server, so that we can effectively manage which writing process is very resource-intensive, so that we can detect abnormalities in time and save our own server.

 

Of course, there are many other uses of Htop, the most used by Big Bird is to kill processes, and arrange processes according to memory, CPU, or user. After this arrangement, it is more intuitive to see and more convenient to manage.

 

If your server CPU or memory usage is always high, try using Htop, which is still very efficient. If you need other more detailed usage, you can go to search, this kind of tutorial is still very rich.

 

 


Leave a Reply

Copyright © All rights reserved. | Newsphere by AF themes.