How to use the htop command to monitor system processes in real time

The htop command in Linux is a command line utility that allows users to monitor important system processes in real time.

The htop command in Linux is a command line utility that allows users to monitor important system processes in real time.

Benefits of htop command

You can track important system resources or processes in real time. The color used in the output makes it much easier to read than the monochrome output of the top command.

Advantages of htop command are:

  1. Support mouse operation
  2. Allows you to scroll both horizontally and vertically, to view all processes and to complete the command line
  3. Lets you end a process without knowing the PID
  4. Start faster than the top command
  5. The top command requires you to enter a PID or priority value to change the priority or extend a process, and the htop does not.
How to use the htop command to monitor system processes in real time Picture 1How to use the htop command to monitor system processes in real time Picture 1
Benefits of htop command

Use the htop command

This command is easily called from the Command Prompt:

 # htop 

The use of the command is divided into 3 parts.

  1. In the first section (upper left corner), we see the bars that show the processor usage, the memory in use, and the swap memory (virtual RAM) in use respectively.
  2. The second part (upper right corner) displays standard information, such as task summary, load average and uptime.
  3. The last section is at the bottom, where you will see 12 columns, including:
    1. PID - Process ID
    2. USER - The process owner's username (or user ID if the name cannot be specified)
    3. PRI - The kernel's internal priority for the process
    4. NI - Nice value of a process - from low priority, 19 to high priority, -20
    5. VIRT - The total capacity of the program in memory
    6. RES - Resident Set Size (memory that the process uses)
    7. SHR - The size of the process share page
    8. S - Process status ( S - sleep / inactive, R - running, D - disk sleep / Drive sleep state, Z - zombie, T - suspended)
    9. W - Paging (memory management mechanism that allows real address spaces to allocate for scattered, discontinuous processes)
    10. CPU% - Percentage of CPU processes currently in use
    11. MEM% - Percentage of process memory currently in use
    12. TIME + - Time (calculated according to the time the process has taken of system and user time)
    13. Command - The full path of the command

As with most Linux commands, there are also options.

 # htop [-dChusv] 
  1. –D - delay (shows the delay between updates, in 1/10 seconds).
  2. –C - no-color (monochrome mode)
  3. –H - help (display the help message and exit)
  4. –U - user = USERNAME (only shows the progress of a given user)
  5. –H - pid = PID (shows only the given PID)
  6. –S - sort-key COLUMN (Sort by this column)
  7. –V - version (output and exit version information)
How to use the htop command to monitor system processes in real time Picture 2How to use the htop command to monitor system processes in real time Picture 2
Information htop provided

You can also use interactive commands while the command is running to change the arrangement / appearance of the window, like:

  1. Arrow, Page Up , Page Down , Home , End - Scroll the progress list
  2. Space - tag or untag a process
  3. U - Untag all processes
  4. s - keep track of system calls
  5. F1 - Help
  6. F2 - Setting
  7. F3 - Search
  8. F4 - Filter
  9. F5 - Tree view
  10. F6 - Sort
  11. F7 - Increase the priority of the selected process
  12. F8 - Decreases the priority of the selected process
  13. F9 - Destroy the process
  14. F10 - Exit ( Esc also works)

You can also sort columns simply by using the mouse.

Both new and experienced Linux users should use the man command to see all the features that the command provides.

 # man htop 
How to use the htop command to monitor system processes in real time Picture 3How to use the htop command to monitor system processes in real time Picture 3
Man command

This command is not only an invaluable utility for experienced Linux users' toolkit, but also useful for new Linux users, helping to better understand how Linux works and explore many interesting things. taste.

5 ★ | 3 Vote