How to Safely Delete Ubuntu ‘Snap Old Revisions’ (Free Up Disk Space)

In modern versions of Ubuntu, most applications (like Firefox, VLC, and Slack) are installed using Canonical’s “Snap” package manager. Snaps are containerized applications that run independently of the core OS. While incredibly stable, the Snap daemon has one massive flaw: by default, every time an application updates, the system keeps the entire previous version of that application saved on your hard drive.

If Firefox updates 5 times in a month, Ubuntu keeps all 5 massive, gigabyte-sized versions of Firefox hidden in the /var/lib/snapd directory. Over a year, these “Old Revisions” will silently eat 20 GB to 40 GB of your storage. Because these old versions are actively mounted by the system, you cannot simply delete the folders. You must safely tell the Snap daemon to remove them.

How to Safely Delete Ubuntu Snap Old Revisions

You must create and execute a simple, automated bash script to instruct the Snap daemon to purge disabled revisions.

  1. Open your Terminal application (Ctrl + Alt + T).
  2. First, we will create a temporary script file on your desktop. Type the following command and press Enter: nano ~/Desktop/clean_snaps.sh
  3. The terminal will change into a simple text editor. Carefully copy and paste the following block of code exactly as written: #!/bin/bash set -eu LANG=en_US.UTF-8 snap list --all | awk '/disabled/{print $1, $3}' | while read snapname revision; do sudo snap remove "$snapname" --revision="$revision" done
  4. Press Ctrl + O to save the file, press Enter to confirm, and then press Ctrl + X to exit the nano editor.
  5. Next, you must make this new script executable. Type this command and press Enter: chmod +x ~/Desktop/clean_snaps.sh
  6. Finally, run the script to safely purge the space. Type this command and press Enter: ~/Desktop/clean_snaps.sh

The terminal will ask for your administrator password. Once entered, the script will rapidly identify every single disabled, outdated version of every Snap application on your PC and issue the official snap remove command to safely purge them. Once the script finishes, you will have successfully reclaimed gigabytes of wasted storage space.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.