Apply for Free VPS

Find what is using disk space

Updated 27 Nov 2026 disk cleanup

Locate large folders and files and clean up without breaking anything.

Overview

df -h
df -i        # a filesystem can run out of inodes while space remains

Largest folders

sudo du -xh --max-depth=1 / 2>/dev/null | sort -h | tail -15
sudo du -xh --max-depth=1 /var | sort -h | tail -15

An interactive tool is easier: sudo apt install ncdu, then sudo ncdu -x /.

Large files

sudo find / -xdev -type f -size +200M -exec ls -lh {} + 2>/dev/null

Common safe clean-ups

sudo apt clean                          # downloaded packages
sudo apt autoremove --purge             # read the list first
sudo journalctl --vacuum-size=300M
docker system df                        # then docker system prune

Deleted but still open

Space is not freed while a program holds a deleted file open:

sudo lsof +L1

Restart the program that holds it.

Do not

Delete files under /var/lib for databases or package managers by hand. See Disk full for recovery steps.

Was this helpful?

Report outdated or incorrect information