Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Created June 29, 2024 19:49
Show Gist options
  • Save diegopacheco/bbd3e065d48697f37312244f31f2717f to your computer and use it in GitHub Desktop.
Save diegopacheco/bbd3e065d48697f37312244f31f2717f to your computer and use it in GitHub Desktop.
Clean Up: Save lots of space in Ubuntu
#!/bin/bash
echo "Clean up APT..."
sudo apt-get autoremove --purge -y
echo "Clean up APT Cache..."
sudo du -sh /var/cache/apt
echo "Clean up systemd journal logs..."
sudo journalctl --vacuum-time=3d
echo "Clean up thumbmail cache..."
rm -rf ~/.cache/thumbnails/*
echo "Clean up Homebrew..."
brew cleanup
echo "Clean up Snap..."
set -eu
LANG=en_US.UTF-8 snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
sudo snap remove "$snapname" --revision="$revision"
done
echo "Clean up Docker..."
docker system prune -f
echo "Clean up Podman..."
podman system prune -f
echo "Listing docker images bigger than 1GB..."
docker image ls -a | grep 'GB'
echo "you can get rid of them by running: docker rmi <image_id>"
@diegopacheco
Copy link
Author

Just free up 81GB by doing this script...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment