Created
June 29, 2024 19:49
-
-
Save diegopacheco/bbd3e065d48697f37312244f31f2717f to your computer and use it in GitHub Desktop.
Clean Up: Save lots of space in Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just free up 81GB by doing this script...