Readers like you help support MUO. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.

One of the key benefits of Linux distros is their package management systems. Package managers on Linux allow you to automate software installation and get the job done with just a few commands.

Unlike other package managers, Snap has good dependency management attributes. But there is a caveat, Snap packages tend to be very bulky and consume a lot of disk space. Fortunately, it's easy to clean up Snap packages on Linux.

Why Are Snap Packages Bulky?

snap package in ubuntu software center

Managing software dependencies has long been an Achilles heel for Linux package managers. Software dependency means when a piece of software relies on other packages or libraries to work properly.

Snap introduced a radical way of handling dependencies on Linux: package software and its dependencies in one single package known as a snap.

However, combining all dependencies and the core software in a single package leads to relatively larger software in comparison to other package managers such as APT, Pacman, etc.

Another reason for bulky Snap packages is that snaps are meant to be rolled back to a previous version after a software update. Both the current and previous software versions are stored on your Linux PC, which translates to snaps consuming so much disk space.

Here's how you can clean up Snap packages and reclaim precious disk space.

1. Remove Rollback Packages

As highlighted earlier, one unique feature of Snap packages is the ability to easily roll back to a previous version of any software package that has been installed via Snap. To achieve this, whenever you update a Snap package to a new version, the old software is still kept on your computer.

To list all installed Snap packages including their rollback versions, run the following command:

 snap list --all 
snap_package_list_all_packages

As you can see, from the preceding output, some packages are listed twice. For example, the canonical-livepatch package has two versions, one that is disabled and another that is active. The disabled one is the previous version of this package that you can roll back to. It is not in use, literally just there consuming disk space.

To remove the previous or disabled Snap package versions, you can use the Rev number. In this case, the Rev number of the disabled canonical-livepatch package is 229, so you can run the following command to remove it:

 sudo snap remove canonical-livepatch --revision=229 

Remember to replace the package name and revision number in the above command.

2. Remove Unused Snap Packages

Occasionally, you should list all snaps installed on your PC using the following command:

 sudo snap list 

Look for any packages that you are not using from the output, and remove them using:

 sudo snap remove package_name 

Regularly monitor how much disk space the packages are consuming using the du command. Snaps are mostly stored in your home directory within the snap folder.

 du -h ~/snap 

3. Remove Unused Package Dependencies

Although Snap is very good at managing dependencies, the challenge is that in some cases it installs more dependencies than required, which leads to packages taking up so much disk space.

For fine-grained control over software dependencies, you should use your distro's default package manager. You can use the following commands to remove unused packages:

On Debian-based Linux distros:

 sudo apt autoremove 

On RHEL-based distros:

 sudo dnf autoremove 

On Arch-based Linux distros:

 sudo pacman -Rns $(pacman -Qdtq) 
removing unused dependencies on arch linux

The preceding command, depending on your distro, will create a dependency tree and remove any package dependencies not needed by your system.

4. Use Another Package Manager if Possible

Let's face it, snaps are nice; but if you are on a machine with limited disk space, it can be wise to use an alternative package manager such as APT, Pacman, or DNF.

First, remove the package using the sudo snap remove package_name command and then reinstall the package using APT or your default package manager.

On Debian-based Linux distros:

 sudo apt install package_name 

On RHEL, run:

 sudo dnf install package_name 

On Arch-based Linux distros, use:

 sudo pacman -S package_name 

Remember to replace package_name in the command with the actual package name.

Note that some software packages only come as Snap packages. So even if you use the default package manager in the background, it will still use Snap to install it. For instance, the Firefox browser on Ubuntu. Even if you use APT, it will install the Firefox Snap package.

Snap Packages Are Great, but They're Bulky!

Despite being bulky, Snap packages come with so many advantages such as better dependency management and security. In addition, Snap packages are universally compatible with all main-stream Linux distros.