remove-old-snaps.sh

This commit is contained in:
Anthony Axenov 2022-01-11 08:43:02 +08:00
parent b955698cbc
commit ae04887a21
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC

10
shell/remove-old-snaps.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
# https://gist.github.com/anthonyaxenov/524faa8636df794a886cb80f73f55e5e
# https://itsfoss.com/free-up-space-ubuntu-linux/
# Remove 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