Disk Usage
df — Disk Free (filesystem level)
df shows how much space is used on each mounted filesystem.
df -h # Human-readable (GB, MB)
df -h / # Specific filesystem
df -T # Show filesystem type
df -i # Show inode usage
Output:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 50G 20G 28G 42% /
tmpfs 3.9G 0 3.9G 0% /dev/shm
⚠️ When disk is 100% full, Linux can crash. Monitor with df!
du — Disk Usage (directory level)
du shows how much space directories and files consume.
du -h # Current directory, human-readable
du -sh # Summary of current directory
du -sh * # Size of each item in current dir
du -sh /var/* # Size of each subdirectory
du -h --max-depth=1 /var # One level deep
Find large files
# Largest directories in /var
du -sh /var/* | sort -rh | head -10
# Largest files anywhere
find / -type f -size +100M 2>/dev/null
# Sort files by size in current directory
ls -lhS
ncdu — Interactive disk usage browser
ncdu /var
Navigate with arrow keys, press d to delete.