Cleaning Up Snap in Ubuntu

To see how much diskspace snap is using, you can run sudo du -sh /* | sort -h

List all the snaps with the following command (note the disabled ones just taking up space): snap list --all and snap list --all | awk '$6~"disabled"{print $1" --revision "$3}'

To purge the unused space in ubuntu 20.04:

snap list --all | awk '$6~"disabled"{print $1" --revision "$3}' | sudo xargs -rn3 snap remove

Run sudo du -sh /* | sort -h to see the difference in /snap

To disable more snaps from being stored more than neccesary, run sudo snap set system refresh.retain=2

Leave a Reply

Your email address will not be published. Required fields are marked *