When a site is slow or an app stops, the cause is almost always one of three things: the disk is full, the memory is used up, or one program is using all the CPU. These commands tell you which, in about two minutes.
Before you start, connect to your VPS with SSH. You can also watch live usage on your server page in your AtoZNode account.
1. Disk space
df -h
Look at the line for /. If Use% is above 90%, free space now. To see which folders are the biggest:
sudo du -h --max-depth=1 /var 2>/dev/null | sort -h | tail -n 8
Common causes are log files in /var/log, old backups, Docker images and uploaded files. Safe clean-ups:
sudo journalctl --vacuum-size=200M
sudo apt clean
docker system df
Check what docker system prune will remove before you run it; read its warning first.
2. Memory
free -h
The number that matters is available. If it is very low and swap is heavily used, the server needs more memory or a lighter app. See how much RAM and CPU a VPS needs, and you can add a safety margin with swap space.
3. CPU and what is using it
uptime
top -o %CPU
uptime shows the load for the last 1, 5 and 15 minutes. As a rule, a load higher than your number of cores for a long time means the server is overloaded. In top, press q to quit. To list the five biggest users of memory:
ps aux --sort=-%mem | head -n 6
4. Is something out of memory?
sudo dmesg | grep -i "out of memory" | tail
If you see lines here, Linux stopped a program because memory ran out. That explains random crashes.
Good to know
- Do not delete files you do not recognise, especially in
/var/lib. Check what a folder is for first. - A disk that fills again quickly usually points to a log or a backup that is never cleaned. Fix the cause, not just the symptom.
- If the numbers stay high even after clean-up, move up a plan.
Run it on your own VPS
Cloud VPS plans: Every plan lists its CPU, RAM and disk. Prices are in rupees, you can pay by UPI, and you get a GST invoice.