How to remove old snap versions on Ubuntu to free up disk space.
To see what snap volumes are currently mounted:
mount | grep snap
or
snap list --all
(thanks to
ErsinErtan!)
Example result:
Name Version Rev Tracking Publisher Notes
core 16-2.32.8 4650 stable canonical core,disabled
core 16-2.33 4830 stable canonical core,disabled
core 16-2.33.1 4917 stable canonical core
pycharm-professional 2018.1.3 66 stable jetbrains disabled,classic
pycharm-professional 2018.1.4 68 stable jetbrains disabled,classic
pycharm-professional 2018.2 78 stable jetbrains classic
rubymine 2018.1.3 25 stable jetbrains disabled,classic
rubymine 2018.1.4 32 stable jetbrains disabled,classic
rubymine 2018.2 39 stable jetbrains classic
In the example above there are several versions of PyCharm. Revisions 68 and 66 are no longer needed.
Uninstalling older revisions:
sudo snap remove pycharm-professional --revision 68
sudo snap remove pycharm-professional --revision 66
Repeat the process with all the other snaps if needed and that's it!
It is also possible to
get and set the maximum amount of retained versions on your system:
sudo snap get system refresh.retain
to see the current number,
sudo snap set system refresh.retain=2
to set the minimum allowed number of versions kept.