How To: find linux disk hogs with du (and more...)
bash-fu
show top 5 largest files/folders from current directory and subdirectories:
du -h | sort -h -r | head -n 5
show top 5 largest files in current directory:
find . -maxdepth 1 -type f -exec du -ah {} + | sort -n -r | head -n 5
sum up file + directory use space (this could take a very long time):
du / -Sh | sort -rh | head -20
And of course to quickly see how much space you have left:
df -h
docker
If you use docker long enough it will eat up a lot of space. If du shows something
like /var/lib/docker/devicemapper/devicemapper
taking up a lot of space get rid
of some docker images
If you are running new-ish docker you can use
docker system prune:
docker system prune --all
Nuclear option:
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
Disk Usage Analyzer (aka Baobab)
If you can use a GUI this is a good tool to quickly find where your space is going. I wish I could use it when managing hosts over ssh.