Skip to content

Instantly share code, notes, and snippets.

@revolter
Last active October 30, 2024 18:23
Show Gist options
  • Save revolter/676db61d6839d924e4eda0b39e695ad0 to your computer and use it in GitHub Desktop.
Save revolter/676db61d6839d924e4eda0b39e695ad0 to your computer and use it in GitHub Desktop.
Free up space in Ubuntu

Instructions:

  • Download the script by running:
    wget https://gist.githubusercontent.com/revolter/676db61d6839d924e4eda0b39e695ad0/raw/autoclean.sh
  • Make the script executable by running:
    chmod +x autoclean.sh
  • Execute the script by running:
    sudo ./autoclean.sh
#!/usr/bin/env bash
set -euo pipefail
apt autoremove
apt-get autoclean
apt-get clean
journalctl --vacuum-time=1d
rm /var/lib/snapd/cache/*
LANG=C snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment