htop - Linux


htop is an interactive process viewer for Unix systems. It is a text-mode application (for the console or X terminals) and requires ncurses. htop provides a more user-friendly and readable view of CPU, memory, and swap usage than the classic top command. It displays a list of processes running on the system alongside their key statistics in real-time. htop allows for scrolling the list vertically and horizontally, allowing users to see all processes and complete command lines. It’s particularly useful in monitoring system health and managing system resources more efficiently.


htop [options]


  • No arguments required: htop can be run without any arguments, which will display the system’s processes and their current statistics.


  • -d –delay: Set a delay time interval between updates, in tenths of seconds. The default is 1.5 seconds (-d 15).
  • -C –no-color: Start htop in monochrome mode.
  • -h –help: Display a help message and exit.
  • -p –pid: Show only the given PIDs, separated by a comma (e.g., -p 123,456).
  • -s –sort-key: Sort by a particular process property, which can be a column name or number.
  • -u –user: Show only processes for a particular user.
  • -v –version: Output version information and exit.


  1. View processes as a specific user:
    htop -u username
  2. Sort processes by memory usage:
    htop -s PERCENT_MEM
  3. Update the process list every two seconds:
    htop -d 20

Common Issues

  • Incorrect permissions: Running htop might require sufficient permissions to view certain processes. Ensure you have the appropriate permissions, or run sudo htop.
  • Unreadable characters: If the display in htop contains unusual characters, try switching to a different terminal emulator or adjust the locale settings.
  • Custom configurations not loading: Make sure that your .htoprc file (if you’ve customized htop) is located in the correct directory (~/.config/htop/htoprc).


htop can be used with shell scripts to monitor system resources and log critical changes. Here’s an example script snippet to check CPU load:

load=$(htop -d 10 -n 1 | grep 'Load average' | cut -d ' ' -f3)
echo "Current Load: $load"

Combine htop with other commands like grep for powerful monitoring:

htop | grep 'nginx'
  • top: Another task manager included in most Unix-like systems.
  • vmstat: Reports virtual memory statistics.
  • iostat: Reports CPU statistics and input/output statistics for devices and partitions.

For more detailed information and advanced features, consult the htop official documentation.