Feb 12, 2024 6 min read

How to Install Htop on Ubuntu 22.04

Install Htop on Ubuntu 22.04 with our step-by-step tutorial. Htop is a powerful system monitoring tool for Linux systems.

Install Htop on Ubuntu 22.04
Install Htop on Ubuntu 22.04
Table of Contents

Choose a different version or distribution

Introduction

Before we begin talking about how to install Htop on Ubuntu 22.04, let's briefly understand – What is Htop?

Htop is a powerful system monitoring tool for Linux systems. It provides a user-friendly interface to track and manage system resources in real-time. With Htop, users can view detailed information about CPU usage, memory allocation, and running processes. This tool allows users to easily identify resource-intensive applications and troubleshoot system issues.

Htop's intuitive design and customizable features make it a preferred choice for system administrators and advanced users. Whether you're monitoring performance or managing system resources, Htop is an essential utility for Linux users.

In this tutorial, you will install Htop on Ubuntu 22.04. We will also address a few FAQs on how to install Htop on Ubuntu 22.04.

Advantages of Htop

  1. Real-time monitoring: Htop provides real-time tracking of system resources, allowing users to instantly view CPU usage, memory allocation, and other vital information.
  2. Intuitive interface: With its user-friendly design, Htop makes it easy to navigate and understand system data, even for less experienced users.
  3. Interactive process management: Htop enables users to manage running processes by providing options to kill, renice, and suspend them directly from the interface.
  4. Customization options: Htop offers various customization features, allowing users to personalize the display, sort processes, and choose which information to show or hide.
  5. Resource efficiency analysis: Htop provides detailed insights into individual processes, helping users identify resource-intensive applications and troubleshoot performance issues efficiently.

Section 1: Install Htop with APT

Step 1: Update System Packages

Make sure that all the installed packages on your system are current before installing Htop. Maintaining system security, stability, and compatibility with the newest software can all be achieved by updating your system packages. Use the following command to update your system packages:

sudo apt update && sudo apt upgrade

This command will give the Htop installation a strong base by updating any out-of-date packages and refreshing the package list.

Step 2: Choose an Installation Method

Method 1: Install Htop from the Ubuntu Repository

The Ubuntu repository is used in the first method of installing Htop. New Ubuntu and Linux users are advised to take this approach since it puts system stability first. You might not be able to access the most recent version of Htop through the Ubuntu repository, so you might not be able to take advantage of the newest features and bug fixes. If you need a more recent version of Htop, you might want to use Method 2's PPA method.

Use this command to install Htop from the Ubuntu repository:

sudo apt install htop

You can use the following command to confirm the installed version after the installation is finished:

htop --version

Method 2: Install Htop using a PPA

Adding the Htop PPA (Personal Package Archive) to your system is the second way to install Htop. Those who require the most recent version of Htop should use this method. Hung-Yi Chen is the PPA maintainer, and for LTS (Long-Term Support) Ubuntu versions, the PPA typically contains the most recent version of Htop.

First, use the following command to install the Htop PPA on your system:

sudo add-apt-repository ppa:gaod/htop -y

Next, run the following command to add the recently added PPA to your system's package list:

sudo apt update

Lastly, run the following command to install Htop:

sudo apt install htop

Section 2: Getting Started with Htop

Htop is a robust and interactive process viewer that offers a plethora of data regarding the resources and processes running on your system. This section will go over some frequently used Htop commands, along with explanations and examples to help you make better use of and understand this adaptable tool.

Step 1: Launch Htop

Open a terminal window and type the following command to launch Htop:

htop

An illustration of Htop on an Ubuntu Linux terminal:

htop example on ubuntu linux

Htop is a free software that shows you your system's processes, CPU, memory, and other important metrics in real time.

Step 2: Navigate and Sort Processes

Htop offers a user-friendly interface for organizing and navigating processes. Below are a few fundamental navigation commands:

  • Up/Down Arrow Keys: Go through each process on the list.
  • Left/Right Arrow Keys: Change between several metrics, including process priority, memory usage, and CPU usage.

To arrange procedures according to a particular measure, hit the associated function key:

  • F6: Processes can be sorted according to user-specified parameters (such as CPU, memory, and process ID).
  • F5: Toggle between the parent-child relationship between processes in the process tree view.

Step 3: Manage Processes

Through its interface, Htop enables you to manage processes directly. The following are a few crucial commands for process management:

  • F9: Send a signal (such as SIGTERM to end the process or SIGHUP to resume it) to the chosen process.
  • F7/F8: Raise or lower the priority (also called "nice" value) of the chosen process. Priority is indicated by lower values for lower priority and higher values for higher priority.

Step 4: Search and Filter Processes

Htop has search and filtering features to make it easier for you to find particular processes quickly:

  • F3: Look up a procedure by name. To highlight the matching process in the list, enter the process name and hit Enter.
  • F4: Utilize user-defined criteria to filter the process list (e.g., process name, user). To see only the matching processes, enter the filtering criteria and hit Enter.

Step 5: Customize Htop Display

Htop provides a range of customization options so you can personalize the display to your liking:

  • F2: To alter the display, colors, and layout, navigate to the Htop setup menu.

Step 6: Quit Htop

Press the Q or F10 key to get out of Htop.

An illustration of the Ubuntu Linux terminal's Setup menu using Htop:

example htop setup menu on ubuntu linux

Section 3: Additional Htop Commands with Ubuntu Linux

We'll look at some more Htop commands for Ubuntu Linux users in this section, along with instructions on how to uninstall Htop and remove its PPA if you installed it that way.

Step 1: Uninstall Htop

In the event that Htop needs to be removed from your computer, the procedure is easy to follow. To uninstall Htop from your Ubuntu Linux system, follow the instructions below.

Step 1.1: Remove Htop Package

To remove Htop, type the following command into your terminal:

sudo apt remove htop

The Htop package and any related files will be deleted from your computer by running this command. To fully remove the PPA, there is one more step to take if you installed Htop using the PPA method.

Step 1.2: Remove Htop PPA (Optional)

You might also want to remove the PPA from your system if you installed Htop using the PPA method, as outlined in Section 1. To accomplish this, run the subsequent command:

sudo add-apt-repository --remove ppa:gaod/htop -y

With this command, you can make sure that your system no longer gets updates from Hung-Yi Chen's Htop PPA by removing it from the list of package repositories.

FAQs to Install Htop on Ubuntu 22.04

Is Htop available in the official Ubuntu repositories? 

Yes, Htop is available in the official Ubuntu repositories. You can install it using the command sudo apt install htop.

Can I install Htop using Snap? 

Yes, you can install Htop using Snap. Run the command sudo snap install htop in the terminal to install Htop via Snap.

How can I launch Htop after installation? 

After installation, you can launch Htop by typing htop in the terminal and hitting Enter. Htop will open and start displaying system resource details.

Is Htop a command-line tool or does it have a graphical interface? 

Htop has a graphical interface that provides an interactive and user-friendly way to monitor system resources. It displays real-time information in a terminal window.

Can I customize the display in Htop? 

Yes, Htop offers customization options. Pressing the F2 key within Htop brings up the setup menu where you can change the colors, sorting options, and other display settings.

How can I sort processes in Htop? 

To sort processes in Htop, use the arrow keys to navigate to the desired column header and press Enter. This will sort the processes in ascending or descending order based on that column.

Can I kill or terminate a process using Htop? 

Yes, you can kill a process using Htop. Select the process you want to terminate using the arrow keys and press the F9 key. Confirm the action when prompted, and the process will be terminated.

Conclusion

We hope this tutorial helped you understand how to install Htop on Ubuntu 22.04.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.