Disk Full on Linux: Find What’s Taking Space + Clean Safely
Identify large files, clear logs/caches, Docker space, and safely free disk space on Linux.
Keywords: disk full linux, no space left on device
1) Find where space is going
df -h
sudo du -xhd1 / | sort -h
sudo du -xhd1 /var | sort -h
2) Usual suspects (safe cleanups)
- APT cache (Ubuntu/Debian):
sudo apt clean sudo apt autoremove --purge - Journal logs:
sudo journalctl --disk-usage sudo journalctl --vacuum-time=7d - Old kernels:
sudo apt autoremoveusually handles this.
3) Docker eating your disk?
docker system df
docker image prune -a
docker container prune
docker volume prune
Be careful: pruning removes unused images/containers/volumes.
4) Find the biggest files quickly
sudo find / -xdev -type f -size +1G -print 2>/dev/null | head
sudo ncdu /
5) Prevent it happening again
Set log limits, monitor disk, and keep Docker/VM images on a separate drive if possible.