How to Monitor CPU Usage in Real-Time Using the top Command in Linux

If your Linux server suddenly becomes incredibly sluggish, or if a specific web application starts repeatedly crashing under heavy load, your very first troubleshooting step must be to analyze the system’s live resource consumption. You need to instantly determine if the CPU is maxed out at 100%, if the physical RAM is completely exhausted, or if a rogue, frozen program has entered an infinite loop and is aggressively eating system resources. The oldest, most reliable, and universally installed diagnostic tool for this critical job is the top command.

How to Launch the System Monitor

Unlike modern graphical task managers, top runs entirely inside the command line, making it perfect for managing headless servers via SSH.

  1. Open your terminal application or connect to your server remotely.
  2. Type the following command and press Enter:
top

The terminal screen will instantly clear and transform into a live, continuously updating dashboard that refreshes every three seconds.

How to Read the Output Dashboard

The screen is divided into two distinct, highly informative sections.

  • The Top Header (Global Stats): The first five lines display the absolute health of the entire server. You can see the system uptime, the load average (how many processes are waiting for CPU time), the total percentage of CPU being utilized, and exactly how much physical RAM and Swap memory is currently free.
  • The Process List (The Culprits): The bottom half of the screen displays a dynamic, constantly shifting list of every single running process on the machine. By default, top sorts this massive list in real-time based on which application is currently using the highest percentage of CPU power (the %CPU column).

How to Exit the Command

Because the top command runs in a continuous, infinite monitoring loop, you cannot type new commands while it is active.

  1. To exit this live dashboard, kill the monitoring process, and safely return to the normal command prompt, simply press the “Q” key on your keyboard.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the best tech tips delivered straight to your inbox.

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

Receive our best articles and tips delivered straight to your inbox.