Skip to main content

Using 'htop' to Monitor System (Better Alternative to 'top')

Updated over 2 weeks ago

Introduction

Most people are familiar with Linux's top command line utility to see which process is taking the most CPU or memory. Although top is included in almost every distribution by default, an improved version, called htop, is available for download from most repositories if required.

htop is an interactive system-monitor process-viewer. It is designed as an alternative to the Unix program top. htop shows a frequently updated list of the processes running on a computer, normally ordered by the amount of CPU usage. Unlike top, htop provides a full list of processes running, instead of the top resource-consuming processes. htop uses color and gives visual information about the processor, swap, and memory status.

For this tutorial, we are using Ubuntu 24.04 distribution; however, you should be able to use it for all Debian and Ubuntu distributions we offer on Time4VPS.

1. Update System

First things first. As always, we recommend updating your server first:

sudo apt update
sudo apt upgrade

2. Installation

On Ubuntu 24.04, htop is installed by default.

To verify the installation:

htop --version

If htop is not found, run:

sudo apt install htop

This command will install htop on your server.

3. Launch Htop

Type htop at a terminal to launch it:

htop

Output example:


Use your Up/Down arrow keys to select a process, and then you can kill it with the F9 key if you’d like, or you can change the priority by using the F7 and F8 keys. You can also use the F6 key to change the default sort column really easily.

Here are some keys that will help you use htop more effectively:

M: Sort processes by memory usage
P: Sort processes by processor usage
?: Access help
k: Kill current/tagged process (You can use F9 as well as mentioned before)
F2: Set up htop. You can choose display options here.
/: Search processes

There are plenty of options that you can access through help or setup. These should be your first stops in exploring htop's functionality.

Did this answer your question?