From ae04887a21e9b2a00ff5356b100f6f979502980c Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Tue, 11 Jan 2022 08:43:02 +0800 Subject: [PATCH] remove-old-snaps.sh --- shell/remove-old-snaps.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 shell/remove-old-snaps.sh diff --git a/shell/remove-old-snaps.sh b/shell/remove-old-snaps.sh new file mode 100644 index 0000000..d6302f5 --- /dev/null +++ b/shell/remove-old-snaps.sh @@ -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