Complete Guide for Using Snap Packages in Ubuntu and Other Linux Distributions

Ubuntu's new universal package Snaps are now everywhere. You should learn the essential snap commands to master this new packaging system.
Warp Terminal

Brief: A beginner’s guide to using Snap packages in Ubuntu or any other Linux distribution. You can also download a free cheat sheet for quick reference.

Canonical introduced a new packaging system called Snap packaging in Ubuntu 16.04 LTS. It claims to be more stable and secure.

However, that secure part of the claim is debatable as a developer shows how easily its security can be circumvented using X11. Debates apart, let’s see what is Snap packaging and how to use Snap packages in Ubuntu or other Linux distributions.

💡
Exclusive bonus: Download snap command cheat sheet for future reference. You can print it or save it for offline viewing.

What are Snap packages?

First, what is ‘packaging’? There are several ways you can install programs in Linux systems. One way is to install it from source code. In here, you manually run the scripts, build dependencies etc. Not user-friendly at all.

This is where ‘packages’ come into the picture. After developing the program, developers ship them in “software packages” so that it can be easily installed. .deb (Debian software packaging) got popular for this reason. The binaries are available in the .deb, one-to-two clicks, and the software is installed.

Now, what was the need for another packaging system for Ubuntu when it is based on Debian and .deb is heavily used in Ubuntu as well? Canonical did it for convergence (similar user experience on a variety of devices) and it is being used in Drones and other similar IoT projects.

From its official website:

A .snap package for the Ubuntu Core system contains all its dependencies. This has a couple of advantages over traditional deb or rpm based dependency handling, the most important being that a developer can always be assured that there are no regressions triggered by changes to the system underneath their app.

How to use Snap packages in Ubuntu and other Linux distributions

Using Snap commands in Ubuntu

Enough talking about Snap packaging. Let’s see how you could use Snap packages in Ubuntu.

First thing first, make sure that your system has snap support enabled. In Ubuntu based Linux distributions, try the command below:

sudo apt install snapd

Please refer to this article to see how to enable Snap support in other Linux distributions.

I presume that you have experience with our popular “apt-get” commands. If not, I recommend reading my other beginner’s guide to apt-get commands in Linux.

Snap is similar to that. It can be used in the terminal and provides a basic set of commands.

1. Finding Snap packages to install

Before we see the command line way, let me tell you about the GUI way. Snap packages are available in Ubuntu Software Center. However, you cannot filter them from the rest of the apps.

If you want to find various Snap apps, you can visit the official Snap website from Ubuntu. You can search by application names here.

To find Snap packages in the terminal, use the following command:

snap find <search_text>

The good thing about the above command is that the search query need not to be exactly the same as the package name. It finds all the matching content with that search query.

Finding Snap packages for installation in Ubuntu Linux
Search for Snap packages

2. Install Snap packages

Once you have found your desired Snap package, you can install the Snap package using the command below:

sudo snap install <package>
Install snap package in Ubuntu 16.04
Install Snap package

You can also use auto-completion option by hitting tab to show packages starting with the string you typed.

3. Keep track of Snap packages

You can also list all the Snap packages installed on your system:

snap list
List all the installed Snap packages in Ubuntu 16.04
List all the installed Snap packages

As you can see, Ubuntu core in Ubuntu 16.04 is already using Snap.

Snap also provides you a history of the changes made to your system with Snap. Use the command below:

snap changes
See the changes made with Snap in Ubuntu 16.04
See the changes made with Snap

It shows all the recent changes I did to my system with Snap.

4. Upgrade and downgrade Snap packages

Snap packages are automatically updated. And installed Snap packages normally checks for updates four times a day and then installs it automatically.

You can also do it manually. If you want to upgrade a Snap package to a newer version manually, use the command below:

sudo snap refresh <package>
Upgrade an installed Snap package
Upgrade an installed Snap package

If the package is already the newer version, it will throw an error.

To see which Snap packages have updates ready to be installed, you can use the command below:

sudo snap refresh --list

For some reason, if you did not like a recent updated Snap package, you can revert it to the previously installed version with this command:

sudo snap revert <package>

5. Remove Snap packages

Finally, you can remove a Snap package using this command:

sudo snap remove <package>
Uninstall a Snap package
Remove Snap packages

At the time of writing this article, Snap doesn’t support auto-completion like apt and apt-get do.

If you prefer videos, here is a quick video on our YouTube channel:

6. Changing channels to switch between beta, release candidate and daily build version

Snap also has a feature called channels. By default, Snap packages are installed from the ‘stable’ channel. But there are few other channels that give you access to the development version of a program. It’s like switching branches in git, if you are familiar with software development.

These channels are:

  • stable: The latest stable release of an application
  • candidate: The release candidate (RC) of an application that is reaching the stable version
  • beta: Unstable version that has reached a certain milestone
  • edge: Daily/nightly build of an application under development

Needless to say that you should stay on the Stable channel but if you really want to change to another channel, you can use Snap command in the following fashion:

sudo snap refresh <package> --channel=<channel_name>

Once you changed the channel, your installed package will get updates from that channel. You can switch back to the old channel either by using the refresh command as shown above or simply using the revert command shown in section four.

7. Install Snap apps offline

You can also install Snap applications without the internet. But first, you need to download the files related to Snap applications on Linux system connected to the internet. You can do that using the command below:

snap download <package_name>

This will download a .assert and a .snap file. You can copy these files to the other Linux system which is not connected to the internet. And then you can install it using the command:

snap ack <package_name.assert>
snap install <package_name.snap>

Bear in mind they also may need to “snap download” the “core” snap and if needed a content snap such as “gnome-3-26-1604” which are needed by some of the GNOME snaps.

Note: Commands and options may change

Snap is under continuous development. This has resulted in the change of commands and their options. There have been several commands changes since this article was first published.

The option to upgrade all installed Snap packages has now gone among other changes. So if you notice other such changes, please notify me so I can update the article accordingly.

How to run Snap applications

A few readers have rightly pointed out that I didn’t mention how to run the Snap applications. Well, you can run Snap applications like any other application installed on your system.

Look for them in the menu, try the command line (you’ll have to guess their run command, normally the application's name) etc.

Worth a Snap?

Initially, there were not many Snap packages available. But Snap adoption has picked up speed, especially when Canonical is pushing for it so hard. They have created Snapcraft tool so that it will be easier for developers to make Snap packages out of their programs.

If you liked this guide to use Snap packages in Ubuntu, I recommend reading my other beginner’s guide to apt-get commands in Linux.

What do you think of Snap packaging? Do you see yourself using more Snap, over apt in the near future?

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.