snap remove all disabled 1

snap remove all disabled

# remove all disabled snaps 
LANG=C snap list --all | while read snapname ver rev trk pub notes; do if [[ $notes = *disabled* ]]; then sudo snap remove "$snapname" --revision="$rev"; fi; done
# free up space 
sudo du -sh /var/lib/snapd/cache/        # Get used space
sudo rm --force /var/lib/snapd/cache/*  # Remove cache

Here is what the above code is Doing:
1. List all installed snaps
2. Remove all disabled snaps
3. Free up space

Similar Posts