Skip to content

htop Linux Command Guide

The htop command in Linux is a powerful interactive process viewer that provides real-time information about system resources and running processes. It is a user-friendly alternative to the traditional top command, offering a more intuitive and customizable interface. With htop, users can easily monitor CPU, memory, and swap usage, as well as manage processes with features like sorting and searching. This guide will walk you through the basics of using htop and help you leverage its advanced capabilities for efficient system monitoring and management.

Terminal window
htop [option]
OptionDescription
-CSort by CPU usage
-MSort by memory usage
-uShow processes of a user
-pShow specific PIDs
-tTree view mode
-HShow threads
-dDelay between updates (in seconds)
-sCumulative time mode
-pProcess ID
-cCommand name/ full path
-vVersion info
-hHelp
ParameterDescription
NoneNo specific parameter
Terminal window
htop

Launches the htop command to monitor system resources interactively in a colorful and efficient way.

Terminal window
htop --sort-key=PERCENT_CPU

Starts htop and sorts the processes based on CPU usage in descending order.

Terminal window
htop --sort-key=PERCENT_MEM

Runs htop and sorts the processes by memory usage in descending order.

Terminal window
htop -p "firefox"

Filters the process list in htop to show only processes related to “firefox”.

Terminal window
htop --highlight-changes

Highlights any new processes that start or end while htop is running.

Terminal window
htop --tree

Displays processes in a tree view, illustrating the parent-child relationship between processes.

Terminal window
htop -C

Saves the current configuration settings in htop for future use.

To use the htop command in Linux, execute the following command:

Terminal window
htop

To search for a process in htop, press F3 and enter the search term. This will highlight the process that matches the search term.

To kill a process in htop, select the process by using the arrow keys and then press F9. Confirm the kill signal by pressing Enter.

How can I change the way processes are sorted in htop?

Section titled “How can I change the way processes are sorted in htop?”

To change the way processes are sorted in htop, press F6. You can then select the sorting parameter such as PID, CPU usage, memory usage, and more.

How can I view detailed information about a process in htop?

Section titled “How can I view detailed information about a process in htop?”

To view detailed information about a process in htop, select the process using the arrow keys and then press F1 for help. This will show you all the available options for viewing process information.

How do I save the current htop configuration settings?

Section titled “How do I save the current htop configuration settings?”

To save the current htop configuration settings, press F10. This will save the settings to the htop configuration file for future use.

  • Monitoring system resources
  • Managing running processes
  • Sorting processes by various criteria
  • Searching for specific processes
  • Renicing processes
  • Killing processes
  • Tree view of processes
  • Viewing detailed process information
  • Customizing display settings