2024-07-26
htop
is an interactive text-mode process viewer for Linux, a powerful alternative to the standard top
command. Unlike top
, which requires constant scrolling to view all processes, htop
offers a dynamic, navigable interface. You can scroll through processes, sort by various metrics, kill processes, and even change process priorities – all without leaving the command-line.
htop
is not typically included in minimal Linux installations. To install it, you’ll need to use your distribution’s package manager. Here are examples for some popular distributions:
Debian/Ubuntu:
sudo apt update
sudo apt install htop
Fedora/CentOS/RHEL:
sudo dnf install htop
Arch Linux:
sudo pacman -S htop
Once installed, simply type htop
in your terminal and press Enter to launch the application.
The htop
interface displays information in a clear, organized manner. Key elements include:
Let’s say you suspect a specific process is consuming excessive CPU resources. After launching htop
, you can:
Spacebar
to sort the list by CPU percentage, making high-CPU consumers easier to spot.K
(SIGTERM) or Shift+K
(SIGKILL) to terminate it.Similar to CPU monitoring, you can effectively analyze memory usage with htop
.
F6
to select “MEM%” as the sorting criteria. This displays the processes consuming the most RAM at the top.Finding a specific process in a long list can be tedious. htop
’s filtering feature is helpful:
htop
will display only processes containing ‘chrome’ in their name.htop
offers many more features, including customizable display settings, interactive process management, and real-time monitoring. Exploring its options through the help menu (usually accessible via F1
) is highly recommended for advanced usage. Its intuitive interface and powerful features make it an indispensable tool for any Linux system administrator or developer.