Commands.page Logo

How to Sort Processes by CPU Usage in htop on Ubuntu

This guide explains how to monitor system performance on Ubuntu by sorting processes based on CPU consumption using htop. You will learn the keyboard shortcuts required to organize the process list instantly, allowing you to identify resource-heavy applications quickly. Follow the steps below to master process management in your terminal.

Install htop

If you have not installed htop yet, open your terminal and run the following command to install it via the package manager:

sudo apt update
sudo apt install htop

Launch htop

Start the application by typing the following command into your terminal and pressing Enter:

htop

Sort by CPU Usage

Once htop is running, you can sort the list of processes to show the highest CPU consumers at the top.

  1. Press the F6 key on your keyboard. This opens the “Sort by” menu.
  2. Use the arrow keys to highlight CPU%.
  3. Press Enter to apply the sort.

Alternatively, if your terminal supports mouse interaction, you can simply click on the CPU% column header to toggle the sort order.

Exit htop

When you are finished monitoring your processes, press the F10 key or q to quit the application and return to the standard command prompt.