Skip to content

Instantly share code, notes, and snippets.

@m-esm
Created March 20, 2020 23:03
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 m-esm/4e01a3fe314879994ee20d83052a377e to your computer and use it in GitHub Desktop.
Save m-esm/4e01a3fe314879994ee20d83052a377e to your computer and use it in GitHub Desktop.
Removes older versions of Snap applications
#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
echo "Current usage:";
du -h /var/lib/snapd/snaps
echo "";
set -eu
snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done
echo "Usage after removing old versions:"
du -h /var/lib/snapd/snaps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment