The following sections provide a basic overview of using snaps, from their installation to their management and manipulation.
The snapd daemon manages the snap environment on the local system. Its installation will include the snap tool for interacting with snaps. You can check both are installed by attempting to run
snap version on the command line:
$ snap version snap 2.35 snapd 2.35 series 16 neon 16.04 kernel 4.4.0-128-generic
If all is well, version numbers for the main system components will be output, as shown above.
If the snap command is not found, or if the command takes a while to respond before reporting that snapd is unavailable, make sure snapd is properly installed before continuing.
"$" above represents the command line prompt. Sample commands come after this prompt with any relevant output shown below.
Searching for snaps
With snapd installed, snaps can be discovered, searched for, and installed from the Snap Store and directly from the command line. For example, the following command returns a list of media players:
$ snap find "media player" Name Version Developer Notes Summary (...) vlc 3.0.4 videolan✓ - The ultimate media player. mpv 0.26.0 casept - a free, open source, and cross-platform media player. (...)
✓ alongside videolan in the above output indicates that the snap publisher has been verified.
Learning about a snap
The snap info command makes it easy to find more details about a specific snap. These details include what a snap does, who publishes it, the command(s) it provides and which channel versions are available for installation:
$ snap info vlc name: vlc summary: The ultimate media player publisher: VideoLAN✓ contact: https://www.videolan.org/support/ description: | VLC is the VideoLAN project's media player. (...) snap-id: RT9mcUhVsRYrDLG8qnvGiy26NKvv6Qkd commands: - vlc channels: stable: 3.0.0 (158) 197MB - candidate: 3.0.0 (158) 197MB - beta: 3.0.0-5-g407d4ba (160) 197MB - edge: 4.0.0-dev-1218-g201542f (159) 197MB
Installing a snap
Installing a snap is straightforward:
$ sudo snap install vlc
Channels are an important snap concept. They define which release of a snap is installed and tracked for updates. The stable channel is used by default, but opting to install from a different channel is easily accomplished:
$ sudo snap install --channel=edge vlc
After installation, the channel being tracked can be changed with:
$ sudo snap switch --channel=stable vlc
Running snap commands
A snap’s installed applications can be found under
/snap/bin, and subsequently, often added to $PATH. This makes commands directly accessible from the command line.
For example, the command installed via the VLC snap is simply vlc:
$ which vlc /snap/bin/vlc
If executing a command directly doesn’t work, try prefixing it with the /snap/bin path:
Listing installed snaps
snap list to show a list of snaps installed on your system:
$ snap list Name Version Rev Tracking Publisher Notes core 16-2.35.1 5419 beta canonical✓ core spotify 188.8.131.523 19 stable spotify✓ - vlc 3.0.4 555 stable videolan✓ -
Some snaps, such as core listed above, are installed by automatically by snapd to satisfy the requirements of other snaps.
Refreshing an installed snap
Snaps are updated automatically. However, to manually check for updates, use the following command:
$ sudo snap refresh vlc
The above will check the channel being tracked by the snap. If a newer version of the snap is available, it will be downloaded and installed.
Changing the channel being tracked and refreshing the snap can be accomplished with a single command:
$ sudo snap refresh --channel=beta vlc
Updates are automatically installed within 6 hours of a revision being made to a tracked channel, keeping most systems up-to-date. This schedule can be tuned via configuration options.
Versions and revisions
Versions and revisions convey different details about one specific release of a snap:
- Version : the version of the software being packaged, as assigned by the developers
- Revision: the sequence number assigned by the store when the snap file was uploaded
The version is a string that was assigned to a project by its developers, according to their development practices. It tells the user what content to expect from a snap. The revision is an automatic number assigned by the Snap store, giving the snap it a unique identity within the channel.
Neither the version nor the revision enforce an order of release. The local system will simply attempt to install whatever snap is recommended by the publisher in the channel being tracked.
Reverting an installed snap
A snap may be reverted to a previously used revision with the
snap revert command:
$ sudo snap revert vlc
This operation will revert both the snap revision and the data associated with the software. If the previously used revision of the snap is from a different channel, that snap will be installed but the channel being tracked won’t change.
A snap won’t automatically be updated to a previously reverted revision. Instead, snapd will wait for a new and different revision to be made available by the publisher and then update.
Reverting twice should work too. Snapd attempts to keep three revisions of a snap available: the most recently installed, plus the two previous installations.
Listing all available revisions
The following command lists all revisions available for every installed snap, and also highlights which particular revisions are disabled at the moment:
$ snap list --all Name Version Rev Tracking Publisher Notes vlc 4.0.0-dev-4620 560 edge videolan✓ disabled vlc 3.0.4 555 edge videolan✓ -
A previously used snap will display disabled in the Notes column of the output.
Manually keeping track of which snap revisions available is generally unnecessary. A single revision will only ever be in use at a time, and snapd will remove old revisions automatically.
Enabling and disabling snaps
If a snaps is temporarily undesired, it can be disabled and later enabled again. This avoids having to remove and reinstall them in the system:
$ sudo snap disable vlc vlc disabled $ sudo snap enable vlc vlc enabled
Where to go next
Last updated 10 days ago. Help improve this document in the forum.