Check CPU, RAM and Disk Usage in Linux — top, free, df
To find out what is loading a Linux server, five commands are enough: top or htop for the processor, free for memory, df and du for the disk. Below is how to use them and how to read the numbers.
CPU load: top
top shows processes in real time, sorted by CPU usage:
top
The key figures at the top:
load average— the average load over 1, 5 and 15 minutes. Rule of thumb: it should not stay above the number of cores.%Cpu(s)— the breakdown:us(user processes),sy(system),id(idle),wa(waiting for disk).
Press P to sort by CPU, M by memory, q to quit. To find the number of cores:
nproc
A friendlier alternative: htop
htop is a colourful interactive equivalent with clear gauges. Install it with:
sudo apt install htop -y
htop
In htop you can scroll the list with the arrow keys, kill a process with F9 and search with F3.
Memory: free
To see RAM usage in a human-readable form:
free -h
Pay attention to these columns:
used— taken by processes;available— what is actually free for new programs (the number that matters);buff/cache— memory used for caching, released on demand, so “used” memory is not always a problem.
Disk space: df
To check how much is used on the mounted filesystems:
df -h
Look at the Use% column. If / is 100% full, the server starts failing. To show inode usage (file descriptors):
df -i
Running out of inodes while space is still free is a classic cause of the “No space left on device” error.
What is eating the disk: du
du shows directory sizes. Find the heaviest folders in the current directory:
du -h --max-depth=1 . | sort -hr | head
To check the large directories from the root:
sudo du -h --max-depth=1 / | sort -hr | head
The usual culprits are logs in /var/log and caches.
Cheat sheet
| Resource | Command | What to look at |
|---|---|---|
| CPU | top / htop |
load average, %Cpu |
| RAM | free -h |
available |
| Disk (space) | df -h |
Use% |
| Disk (inodes) | df -i |
IUse% |
| Large folders | du -h --max-depth=1 |
directory sizes |
Quick diagnosis when things slow down
uptime # average load
free -h # free memory
df -h # free space
top # which process is loading the CPU
If wa in top is high, the disk is the bottleneck. If available in free is close to zero, you are out of memory and should add swap.
Frequently asked questions
Why does free show so little free memory?
Linux uses spare RAM for the disk cache (buff/cache) and releases it on demand. Look at the available column, not free.
What do I do if the disk is 100% full?
Find the heavy directories with du, clear logs and caches, delete files you no longer need. sudo journalctl --vacuum-size=200M often helps.
top or htop — which is better?
top is available everywhere by default, htop is more convenient and more readable. Install htop for day-to-day work, but it is worth knowing plain top.
How do I know it is time to add resources?
If load average stays above the number of cores, available memory is near zero and the disk is full, the server has hit its limits and it is time to move to a bigger plan.
Summary
Five commands — top/htop, free, df, du — cover basic server monitoring. Checking them regularly helps you spot a problem before it turns into downtime.
Hitting the resource ceiling? Pick something bigger in the Linux VPS section, order VPS hosting, or order Server administration.