7
My server disk is getting full. How can I find which files and directories are taking up the most space?
Loading...
Q&A · Answered
My server disk is getting full. How can I find which files and directories are taking up the most space?
Accepted answer
# Human-readable disk usage
df -h
# Show only local filesystems
df -hl
# Find top 10 largest directories
du -h --max-depth=1 / | sort -hr | head -10
# Find files larger than 500MB
find / -type f -size +500M -exec ls -lh {} \;
# Interactive disk usage analyzer
sudo apt install ncdu
ncdu /Say what you tried, not only what worked — the next person needs the reasoning. Code goes in a fenced block.