When a Linux server becomes sluggish, system administrators do not reach for a mouse—they use the top command. The top command provides a real-time, dynamic dashboard showing everything happening on your system, allowing you to instantly identify which processes are hogging your CPU or memory.
Running the Command
To launch the dashboard, open your terminal and simply type:
top
The screen will fill with updating data. (To exit this screen at any time, just press the q key).
How to Read the Top Dashboard
The dashboard is split into two sections: a system summary at the top, and a list of running processes at the bottom.
1. The System Load (Top Line)
Look at the top right corner for the “load average:” followed by three numbers. These represent the system load over the last 1, 5, and 15 minutes. A load of 1.0 means one CPU core is fully utilized. If your load average is consistently higher than the number of CPU cores your machine has, your server is overloaded.
2. CPU Usage (The %Cpu(s) Line)
This line breaks down what your processor is doing. The most important metric here is id (idle). This shows the percentage of time your CPU is doing absolutely nothing. If your idle time is close to 0%, your CPU is maxed out.
3. Memory Usage (The Mem Line)
This shows your total, free, and used RAM. Do not panic if “free” looks very low; Linux intentionally uses spare RAM to cache data for faster access. Look at the avail Mem metric instead—this shows how much RAM is actually available for new applications to use.
4. The Process List
The bottom section lists individual applications.
- %CPU: How much processing power the app is using.
- %MEM: How much RAM the app is consuming.
- RES: The actual physical memory (in kilobytes) the process is holding.
- COMMAND: The name of the process.
Interactive Shortcuts for the Top Command
While top is actively running, you can press these keys on your keyboard to change how the data is displayed:
Shift + M: Sorts the process list by Memory usage (highest at the top).Shift + P: Sorts the process list by CPU usage (this is usually the default).k: Allows you to kill (force quit) a process. It will ask for the PID (Process ID), which you can find in the far-left column of the process list.c: Toggles the “COMMAND” column to show the full file path of the process instead of just the name.