Skip to content

Instantly share code, notes, and snippets.

@bluwy
Created May 4, 2021 06:18
Show Gist options
  • Save bluwy/eeeb70fe4a36bbc98c0fd4ff94e50972 to your computer and use it in GitHub Desktop.
Save bluwy/eeeb70fe4a36bbc98c0fd4ff94e50972 to your computer and use it in GitHub Desktop.
Remove unused snaps
#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
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