System
df & du CLI
df and du commands for disk usage monitoring.
24 commands
Windows
MacOS
Linux
#disk-usage
#storage
Disk Free Space
Show disk space in human-readable format
df -h
Show disk space in SI units
df -H
Show filesystem type column
df -T
Show inode usage instead of block usage
df -i
Show disk space for specific mount
df -h /home
Show grand total of all filesystems
df --total
Directory Usage
Show total size of current directory
du -sh .
Show size of each item in directory
du -sh *
Show total size of a specific path
du -sh /var/log
Show sizes one level deep
du -h --max-depth=1
Show size of all files and directories
du -ah .
Show size of each home directory
du -sh /home/*
Sorting & Filtering
Sort directory sizes largest first
du -sh * | sort -hr
Show top 10 largest items
du -sh * | sort -hr | head -10
Exclude files matching a pattern
du -sh --exclude='*.log' /var
Show only entries above 100M
du -h --threshold=100M /
Show top 20 space consumers
du -sh * | sort -hr | head -20
Monitoring
Monitor disk space every 5 seconds
watch -n 5 df -h
Monitor directory size periodically
watch -n 10 'du -sh /var/log'
Custom output columns for df
df -h --output=source,size,used,avail
Show sizes in megabytes
du -s --block-size=1M /var/*
Quick Commands
Display disk space usage in human-readable format
df -h
Show total size of a directory
du -sh <directory>
List items sorted by size, largest first
du -sh * | sort -hr