Submit News Alternative Tip Form

6 Essential Ubuntu Snap Commands You Should Know

screen-shot-2016-12-12-at-21-24-22

Snapd is the “behind the scenes” machinery that lets you install, update and run Snap apps on Ubuntu.

Snapd 2.18 was recently released. It introduces a couple of new Snap commands, and improves on a few old ones.  Canonical’s David Calle recently ran through the additions, and I figured I’d use the spec bump to write a quick overview of Snap commands.

The following guide presents 6 Essential Snap Commands that you should know. These will let you install and manage Snap applications on Ubuntu (16.04 LTS or later) simply and competently.

Now, caveat time. Some of the commands listed only work in snapd 2.18 (or later). While supported versions of Ubuntu 16.04 and up get (most) Snapd updates automatically through the standard software updates, Snapd 2.18 is not currently available on either Ubuntu 16.04 LTS or Ubuntu 16.10.

But if for some reason you’re running Ubuntu 17.04 daily, you can run ’em all.

6 Essential Snap Commands

Before we begin you may still be wondering: what is a Snap App?

Well, a ‘Snap app’ is self-contained package that includes all of the dependencies and libraries that an application needs to run. These apps are  sandboxed, install to their own directory, and can’t touch, see or otherwise ‘interface’ with the rest of your system without your permission. Snap apps can run across Linux OSes (thanks to Snapd) which makes the technology a potential antidote to the headache of Linux application distribution.

How to log in to Ubuntu One

sudo snap login your@email.lol

The login command (when run as sudo) does exactly what you’d expect it to: it lets you log in and authenticate with your Ubuntu One account. This then lets you purchase snaps using the snap buy command.

With zero snaps available to buy you probably won’t need to use this one. For reference, credentials are stored in the ~/.snap/auth.json file.

Find Snap Apps to Install

If there’s a barrier to Snap app adoption (aside from few apps being made available in the format) it’s knowing which packages are available in the Snap app store. Well, wonder not. Simply pop open a terminal and run the following command:

snap find query

The find command lets you quickly search for and discover snaps available to install from the command line. It can be run with a query after it (e.g., ‘snap find email‘, ‘snap find media’, ‘snap find messaging‘) or without.

When run without a query you’ll instead see a list of featured snaps.

You can also pass the --section= flag after the command to filter results based on a specific section of the Snap store. The Ubuntu Snap Store (the one enabled by default) has a number of sections, including: featured, databaseinternet-of-thingsmessaging, and media.

For a “GUI” to browsing snaps on the store you can use the ‘Snap Apps’ section of Brian Douglass’s wonderful uAppExplorer website.

Browse Snap Apps on uAppExplorer

See a list of Installed Snap Apps

screen-shot-2016-12-12-at-21-24-22

Installed some Snaps but can’t remember what? Don’t panic. Use the list command to see an up-to-date list of all Snap apps installed on your system:

snap list

This list also shows you their version number, revision number and the name of the developer who uploaded it (handy when there are multiple versions of the same app in the store, e.g., Telegram).

If you’ve installed some development software by passing a channel or override to to install command the notes section will, helpfully, mention it.

How to install Snap apps (and remove ’em)

$ snap install appname
$ snap remove appname

If you’re used to managing software using apt you’ll instantly find the analogous snap commands easy to remember. You install snap apps with the ‘install’ command, and remove them using the ‘remove’ command.

See more information about a Snap app

snap info appname

A brand new command arrives with Snapd 2.18, the info command.

You can use this to see detailed information about any snap application, whether it is installed or not. This info includes the application’s release channel, confinement status, size, number of revisions, and more. The snap info --verbose offers a greater overview.

Update a Snap App

snap refresh

Rather helpfully you probably won’t ever need to remember to install an update to a Snap app. This is because Snapd runs in the background and handles updates automatically (you can, ofc, revert a Snap update or install a specific revision).

But if you’re ever curious you can run the refresh command to check for and apply any updates to all your installed Snap apps, or specify a particular snap to update.