📝 How to remove “old” versions from snap packages

Be careful with this. Don't remove old versions before ensuring the new package version works as expected.

How to list all the installed versions

LANG=C snap list --all | awk '/disabled/{print $1, $3}'

How to remove all the old versions in a batch

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

This can save you some disk space, but it can become a headache if you don't make sure the new snap package version is working well. Also, don't forget to read the fine manual.

#Linux #Ubuntu #Snap #Tips