Skip to content

Instantly share code, notes, and snippets.

@VictorGob
Last active December 5, 2019 07:35
Show Gist options
  • Save VictorGob/be4e5dc6fe9ca27f633dfb9383f2a143 to your computer and use it in GitHub Desktop.
Save VictorGob/be4e5dc6fe9ca27f633dfb9383f2a143 to your computer and use it in GitHub Desktop.

Revisions

  1. VictorGob revised this gist Dec 5, 2019. No changes.
  2. VictorGob created this gist Dec 5, 2019.
    15 changes: 15 additions & 0 deletions remove_old_snaps.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/bin/bash
    # Removes old revisions of snaps
    # CLOSE ALL SNAPS BEFORE RUNNING THIS

    set -eu

    if [ $EUID != 0 ]; then
    sudo "$0" "$@"
    exit $?
    fi

    sudo snap list --all | awk '/desactivado/{print $1, $3}' |
    while read snapname revision; do
    snap remove "$snapname" --revision="$revision"
    done