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.

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 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 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 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

May be interested

  • Use the Top command to see the processes running in LinuxUse the Top command to see the processes running in Linux
    the top command in linux is used to display all processes running in the linux environment. this tutorial shows you how to use the top command through explaining the various parameters available and the content they display.
  • How to monitor network usage for Linux processesHow to monitor network usage for Linux processes
    internet access is essential, but you may be wondering which linux processes use your connection the most on your computer.
  • How to fix the problem of too many background processes running on Windows PCHow to fix the problem of too many background processes running on Windows PC
    the windows operating system is very large, with many applications, processes and services running simultaneously. these apps may not be visible to you in desktop view, but you can simply open task manager to discover the many processes running in the background.
  • Monitor Hyper-V with the command line (Part 1): Install the monitoring libraryMonitor Hyper-V with the command line (Part 1): Install the monitoring library
    one of the obvious shortcomings of hyper-v is the ability to monitor virtual machines from windows powershell. although microsoft intends to provide this capability on windows server 8, users can fully monitor virtual machines from the command line interface at this time. the article will guide you to do this
  • How to Install and Use Grafana for Real-Time Data VisualizationHow to Install and Use Grafana for Real-Time Data Visualization
    this tutorial will show you how to install grafana using docker and how to use this tool to monitor system metrics and visualize real-time data effectively.
  • System () function in CSystem () function in C
    the int system (const char * command) function passes the command name or program name specified by the command to the host environment to be executed by the command processor and returned after the command is completed.
  • How to use the Netstat command in Windows 11 to monitor network activityHow to use the Netstat command in Windows 11 to monitor network activity
    netstat is a command-line utility that helps you monitor all the technical characteristics of your active network connections.
  • 10 useful commands in Windows you should know10 useful commands in Windows you should know
    command prompt is used to execute batch files, perform tasks quickly, help you troubleshoot and solve some windows problems when the system crashes. however, not all commands in windows are useful and must be done regularly. with the 10 command lines in the following article it is very useful even if you are not an administrator.
  • How to use the Linux command line on Android with TermuxHow to use the Linux command line on Android with Termux
    android is a very operating system 'capacity with more and more desktop accessibility applications. however, sometimes you want to make some things on android that can be as easy as desktop. fortunately, you can use the termux tool, which builds on the existing infrastructure and provides a command line environment that allows you to install real linux applications on your android device.
  • Instructions for managing programs in Ubuntu via the command lineInstructions for managing programs in Ubuntu via the command line
    as we all know, ubuntu has a lot of tools to support graphic delivery to install software and applications inside the system, but users have to search. however, for those who love and have spent a lot of time using this open source operating system, the process of handling and manipulating the command line simply through the keyboard will be much faster and save time. .