Skip to content

Instantly share code, notes, and snippets.

@voznik
Forked from jdatti/ubuntu18-clean-old-snaps.sh
Created April 10, 2019 07:04
Show Gist options
  • Save voznik/a69a88626795248092fc30e150039832 to your computer and use it in GitHub Desktop.
Save voznik/a69a88626795248092fc30e150039832 to your computer and use it in GitHub Desktop.
Ubuntu clean old snaps
#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
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