Back to TILs

clean up snap

Date: 2023-01-30Last modified: 2023-03-07

Table of contents

Introduction

#!/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 -r snapname revision; do
    snap remove "$snapname" --revision="$revision"
  done

References