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

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 cheatsheet 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.

[irp posts = “11662”]

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 use the revert command shown in section four.

7. Install Snap apps offline

You can also install Snap applications without 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 option may change

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

The option to upgrade all installed Snap packages has now gone among other such changes. So if you notice other such changes, please notify me so that 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 command line (you’ll have to guess their run command, normally the name of the application) 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 near future?

Similar Posts

  • Filezilla 3.60.1 is the latest (July,2022) version and is available for Windows from their website.
    But the Linux (debian) version seems to only come in a zip file, that unzips into 3 folders- bin, lib and share.

    How can we use these folders to install Filezilla?

  • Snaps are probably the worse way to package an app I have ever experienced. I just installed codium since it wasn’t available in the apt repository and I have no idea how to run the executable.

    Look for them in the menu,
    Not there even in ‘All Applications’

    try command line (you’ll have to guess their run command, normally the name of the application) etc.
    Um…really? This is totally unacceptable to expect any user to magically know what to type to run the app. Of course, simply typing ‘codium’ doesn’t run the executable like I would expect.

    When somebody decides to provide an alternative way to package apps, they really should try to make it easier for the user, not harder. /endrant

  • This is weird… Does snap mess with my PATH? Or use another path search?
    I have GNU Octave installed as a snap (the official apt/deb repository is quite old). One can run Octave from the command line simply as ‘octave’. And typing ‘which octave’ gives “/snap/bin/octave” which is fine.
    However, if I put an executable shell script called ‘octave’ in my ~/bin/ directory, to set up some things before it in turn calls ‘/snap/bin/octave’, my script fails to execute. It seems ‘/snap/bin/octave’ is found first.
    My PATH clearly has ‘/home/me/bin’ near the beginning and ‘/snap/bin’ at the end. Typing ‘which octave’ now says “/home/me/bin/octave”. Except that is not what is executed.
    Whaaa? Any help much appreciated; I’ve searched online high and low.

  • Snaps suck.
    I need to install a lua extension of the VLC media player, which means to copy the file to an installation subdirectory, and snap doesn’t allow me to do such operation, because it’s read only. Are the security benefits worth so much trouble for the user?