Htop is an interactive process viewer for Unix systems that provides a real-time, dynamic overview of system processes. It is a more advanced alternative to the classic top command, offering features such as user-friendly color-coded displays, customizable meters, and the ability to manage processes directly from the interface. Htop is widely used by system administrators and users who need to monitor system performance and resource usage effectively.
On Ubuntu 24.04, 22.04, or 20.04, Htop can be easily installed via the terminal using the Ubuntu default repository. This method provides a straightforward and reliable installation process, ensuring you have access to the latest stable version available within the repository. This guide will show you how to install Htop using the command-line terminal.
Update System Packages Before Htop Installation
Before installing Htop, it’s crucial to ensure that all existing Ubuntu packages on your system are up to date. Updating your system packages helps maintain system stability, security, and compatibility with the latest software.
To update your system packages, run the following command:
sudo apt update && sudo apt upgrade
This command will refresh the package list and upgrade any outdated packages, providing a solid foundation for the Htop installation.
Install Htop via APT Command
To install Htop from the Ubuntu repository, execute the following command:
sudo apt install htop
Once the installation is complete, you can verify the installed version by running the following command:
htop --version
Getting Started with Htop
This section will explore some common Htop commands, including examples and explanations to help you better understand and utilize this versatile tool.
Launch Htop
To start Htop, open a terminal window and enter the following command:
htop
Example of Htop on Ubuntu Linux terminal:
Once launched, Htop will display a live, interactive view of your system’s processes, CPU usage, memory usage, and other essential metrics.
Navigate and Sort Processes with Htop
Htop provides an easy-to-use interface for navigating and sorting processes. Here are some basic navigation commands:
- Up/Down Arrow Keys: Navigate through the list of processes.
- Left/Right Arrow Keys: Switch between different metrics, such as CPU usage, memory usage, and process priority.
To sort processes based on a specific metric, press the corresponding function key:
- F6: Sort processes by user-defined criteria (e.g., CPU usage, memory usage, process ID).
- F5: Toggle the process tree view, displaying the parent-child relationship between processes.
Manage Processes with Htop
Htop allows you to manage processes directly from its interface. Here are some essential process management commands:
- F9: Send a signal to the selected process (e.g., SIGTERM to terminate the process, SIGHUP to restart the process).
- F7/F8: Increase or decrease the selected process’s priority (also known as “nice” value). Lower values indicate higher priority, while higher values indicate lower priority.
Htop Search and Filter Processes
Htop provides search and filter functionalities to help you quickly locate specific processes:
- F3: Search for a process by name. Enter the process name and press Enter to highlight the matching process in the list.
- F4: Filter the process list based on user-defined criteria (e.g., process name, user). Enter the filtering criteria and press Enter to display only the matching processes.
Customize Htop Display
Htop offers various customization options to tailor the display to your preferences:
- F2: Access the Htop setup menu, where you can customize the display, colors, and layout.
Quit Htop
To exit Htop, press either the F10 key or the Q key.
Additional Htop Commands
In this section, we will explore additional Htop commands for Ubuntu Linux users, including how to uninstall Htop.
Remove Htop
If you need to uninstall Htop from your system, the process is simple. Follow the steps below to remove Htop from your Ubuntu Linux system.
Remove Htop Package
Execute the following command in your terminal to uninstall Htop:
sudo apt remove htop
This command will remove the Htop package and associated files from your system.
Closing Thoughts
With Htop installed on your Ubuntu system, you gain a powerful tool for monitoring and managing system processes in real-time. Installing it via the Ubuntu default repository is quick and simple, ensuring that you can immediately start using Htop’s advanced features for system administration tasks. Regularly updating your system will keep Htop current, providing you with the latest enhancements and bug fixes. Enjoy the efficiency and clarity that Htop brings to process management on Ubuntu.