Created
January 20, 2024 14:27
-
-
Save Aviksaikat/3d75c30605d1ce8e27c354c67196d3ac to your computer and use it in GitHub Desktop.
remove old versions of snap packages
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 | |
# Removes old revisions of snaps | |
# CLOSE ALL SNAPS BEFORE RUNNING THIS | |
echo "Size before cleanup" | |
du -h /var/lib/snapd/snaps | |
set -eu | |
snap list --all | awk '/disabled/{print $1, $3}' | | |
while read snapname revision; | |
do | |
snap remove "$snapname" --revision="$revision" | |
done | |
echo "Size after cleanup" | |
du -h /var/lib/snapd/snaps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment