How to Check Your CPU Usage in Ubuntu Terminal

The Central Processing Unit (CPU) is the brain of your server. If a web application gets stuck in a loop, or if a database query is poorly optimized, it can consume 100% of your CPU’s processing power. When this happens, the entire server will grind to a halt, websites will fail to load, and your SSH connection will become agonizingly slow.

When managing an Ubuntu Linux server via a terminal, you must know how to quickly check your CPU usage to identify exactly which rogue process is choking your system.

The Basic Method: The ‘top’ Command

The top command is a classic, universally available Linux utility. It is pre-installed on every single Ubuntu server and provides a real-time, constantly updating list of the most resource-intensive processes on your machine.

  1. Open your terminal or SSH into your server.
  2. Type the following command and press Enter:
top

Your terminal window will immediately transform into a dense, constantly shifting dashboard.

How to Read the ‘top’ Output

  • The Summary Header: Look at the third line from the very top, which begins with %Cpu(s). The most important number here is id (idle). If the idle percentage is at 95.0, your server is relaxed. If the idle percentage is at 0.0, your CPU is completely maxed out.
  • The Process List: The main body of the screen lists individual processes. Look specifically at the %CPU column and the COMMAND column on the far right. This immediately tells you that a specific program (like mysql or php-fpm) is consuming 85% of your processor.

To exit this dashboard and return to your normal command prompt, press the Q key on your keyboard.

The Modern Upgrade: Using ‘htop’

While top is reliable, it is visually ugly and difficult to read. The modern standard for Linux administrators is a greatly improved utility called htop. It provides a beautiful, colour-coded, interactive interface.

Most modern Ubuntu servers have it pre-installed. To run it, simply type:

htop

If the terminal returns a “command not found” error, you must install it first by running: sudo apt update && sudo apt install htop.

Why ‘htop’ is Better

  • Visual CPU Bars: At the very top of the screen, htop displays a colour-coded progress bar for every individual core in your CPU (numbered 1, 2, 3, etc.). You can instantly see if one specific core is maxed out while the others are resting.
  • Interactive Management: Unlike the standard top command, htop allows you to use your mouse (or arrow keys). You can click on a rogue process that is consuming too much CPU, press the F9 key to send a “Kill” signal, and instantly terminate it without having to memorize complex process IDs.

Just like the older utility, you can press the Q key (or F10) to exit htop and return to your terminal prompt.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.