Although Ubuntu 16.04 – which was released last month – brings several changes to the table, one of the most talked about new features included in this latest Ubuntu version is Snap, which is basically a new packaging format. Fret not, the legacy deb packaging format isn’t going anywhere (at least for now); the new OS release supports both.

Just like the long-known deb format has its own commands to perform operations on .deb packages, there are commands dedicated to managing Snap packages as well. In this article we will learn how to perform basic management operations on Snap packages.

Why Snap?

Before proceeding towards learning the practical usage, it’s important that you are theoretically clear about the new packaging system.

In layman’s terms, we can say that this new packaging system is aimed at making package installation and maintenance easier. For example, unlike the existing system, where it’s on you to resolve all version-related conflicts of dependencies for a software being installed, Snaps allow developers to put in everything their software depends on in the package itself, effectively making them self-contained and independent of the system on which they are being installed.

Here’s what Canonical (Ubuntu’s parent company) has to say about Snap:

Interested in learning more about Snap? Head to the discussion here.

Snap package management commands

Before jumping to the standard Snap commands, you first need to install the snappy command line tools on your system, if they haven’t been already, by following this command:

Install Snap packages

The following is the template command for installing Snap packages:

For example, here is the command I used to install the “htop” application:

This  is how it was installed:

List all installed Snaps

To display a summary of all the installed Snap packages on your system, run the “Snap” command with list sub-command:

Update a Snap

To update a particular snap to a more recent or latest version, use the refresh sub-command followed by the package name. For example, if in the future I’ll have to update the “htop” tool, I’ll run the following command:

Find Snap packages

A find sub-command is available for this operation. It queries for available packages. Here’s an example:

You can also search for a particular Snap, such as this example:

Remove a Snap

Similar to the way you install a Snap, you can easily remove a Snap package from your system – the sub-command to use in this case is remove. In this example I removed the “htop” tool:

Please note that Snap’s man page talks about a purge sub-command in the section discussing remove. Specifically, it says that with the remove sub-command, the snap’s data is currently not removed; use purge for that. However, in reality, there’s currently no “purge” sub-command available. Somebody even filed a bug report related to this. From what we can tell, the man page isn’t yet updated as it ends the section saying, “this behaviour will change before 16.04 is final.” Don’t get confused.

For more available options, go through the Snap man page (run man snap on the command line).

Conclusion

The Snap packaging system has been developed keeping user convenience as well as developer convenience in mind. However, given that it’s been made available to mainstream Ubuntu users in the latest release, there may be some bugs or missing features.

It’s not difficult to learn Snap commands, so we’d encourage you to start using this new system and report any bugs or feature requests through proper channels. It would help the Snap system mature. And as for deb, it’s not going away in the near future for sure but will definitely be phased out over the coming years.

Himanshu Arora is a freelance technical writer by profession but a software programmer and Linux researcher at heart. He covers software tutorials, reviews, tips/tricks, and more. Some of his articles have been featured on IBM developerworks, ComputerWorld, and in Linux Journal.

Our latest tutorials delivered straight to your inbox