Last active
June 2, 2022 08:50
-
-
Save AndreasGrip/1f82c58950df35550908e09dfc384060 to your computer and use it in GitHub Desktop.
Ubuntu reclaim space. (needed on free aws servers)
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/sh | |
echo df -h before run | |
df -h | |
# Remove old versions of snap no longer used | |
set -eu | |
snap list --all | awk '/disabled/{print $1, $3}' | | |
while read snapname revision; do | |
#echo "$snapname" "$revision" | |
snap remove "$snapname" --revision="$revision" | |
done | |
# Remove any packages installed by apt no longer used | |
apt autoremove | |
# Remove clean the apt cache | |
apt clean | |
echo df -h after run | |
df -h |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment