Question regarding snaps and removing older versions

Firstly - I like snaps. Maybe you might consider me a Canonical fanboy - but I actually prefer the ease of snaps. However... Is there a way to remove old snaps? Specifically, prior versions of updated snaps...

As an example, if I run snap list, I get a list of the 13 snaps that are installed on my system, but if I run lsblk, I see duplicate snaps, with different version... as an example

loop3    7:3    0    32.4M   1 loop /snap/snapd/13640
loop5    7:5    0    42.2M   1 loop /snap/snapd/14066

loop6    7:6    0   217.4M   1 loop /snap/code/81
loop15   7:15   0   222.2M   1 loop /snap/code/82

So is there any reason why I would need to keep snapd/13640 or code/81? There are several others, but also since VSCode (the snap/code) updates monthly, if I leave it alone for a year, that snap alone will take up 2Gb of space, that I'm thinking is mostly unnecessary.

So, If I am able to, how do I go about removing (and unlinking from loop) these snaps. And if I'm not, why not?

Thanks in advance for any imparted knowledge!

snap list --all should show the last column (Notes) marked disabled. Those can be removed.

1 Like

So that answers the question that yes I can remove those - but the question still comes on how do I go about removing those?

Found a small script, look at

HTH

4 Likes

Thank you - I may or may not remove these old ones - but I'll definitely use the option to limit the older versions to 2... I don't need 3 or more versions back - just the current and one back in case there is an issue with the current!