Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Abhinav1217
Created June 7, 2020 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Abhinav1217/c1c0e3fd9d23946649759eaf1415ca85 to your computer and use it in GitHub Desktop.
Save Abhinav1217/c1c0e3fd9d23946649759eaf1415ca85 to your computer and use it in GitHub Desktop.
# https://superuser.com/questions/1310825/how-to-remove-old-version-of-installed-snaps/1330590#1330590
# https://www.linuxuprising.com/2019/04/how-to-remove-old-snap-versions-to-free.html
#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
LANG=en_US.UTF-8 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