What this is
This guide helps you identify large files and directories that are filling your VPS disk.
What it is for
- Fix “disk full” problems
- Locate big logs, backups, uploads, cache
Prerequisites
- SSH access
- Sudo privileges may be needed to scan all directories
Step-by-step
Step 1) Confirm disk usage
df -h
Step 2) Find the largest directories under / (quick overview)
sudo du -xh / --max-depth=2 2>/dev/null | sort -h | tail -n 20
Expected output: Top 20 largest directories (depth 2).
Step 3) Drill down into a large directory
Example for /var:
sudo du -xh /var --max-depth=2 2>/dev/null | sort -h | tail -n 20
Step 4) Find large files (example: bigger than 1GB)
sudo find / -type f -size +1G -print 2>/dev/null | head -n 50
What it does: Lists files larger than 1GB.
Step 5) Show file sizes for a directory (human readable)
sudo find /var -type f -printf "%s %p\n" 2>/dev/null | sort -n | tail -n 20
Warnings & safe cleanup notes
- Do not delete database files or system files unless you are sure.
- Large log files can often be rotated instead of deleted.
- Backups may be safe to move to external storage.
Final verification
df -h
Conclusion
With du and find, you can quickly locate disk usage hotspots and plan safe cleanup.