LinuxCommandLibrary

snap.pkg

Manage Snap application packages

TLDR

Search for a package

$ snap find [query]
copy

Install a package
$ snap install [package]
copy

Update a package
$ snap refresh [package]
copy

Update a package to another channel (track, risk, or branch)
$ snap refresh [package] --channel=[channel]
copy

Update all packages
$ snap refresh
copy

Display basic information about installed snap software
$ snap list
copy

Uninstall a package
$ snap remove [package]
copy

Check for recent snap changes in the system
$ snap changes
copy

SYNOPSIS

snap [OPTIONS] COMMAND [ARGS...]

Common Commands:
snap install snap_name [options]
snap remove snap_name [options]
snap refresh snap_name [options]
snap list
snap find [search_term]
snap info snap_name
snap run snap_name.app_name

PARAMETERS

install snap_name
    Installs a snap from the Snap Store or a local file.

remove snap_name
    Removes an installed snap from the system.

refresh snap_name
    Updates an installed snap to its latest available revision.

list
    Lists all currently installed snaps along with their versions and health status.

find [search_term]
    Searches for snaps in the Snap Store. If no term is provided, lists popular snaps.

info snap_name
    Displays detailed information about a specific snap, including its publisher, interfaces, and channels.

run snap_name.app_name
    Executes a specific application or command provided by an installed snap.

connect plug slot
    Connects a snap interface 'plug' to a 'slot', allowing the snap to access specific system resources.

disconnect plug slot
    Disconnects a snap interface, revoking access to specific system resources.

revert snap_name
    Reverts a snap to its previously installed revision, useful for troubleshooting updates.

set snap_name key=value
    Sets configuration options for a specific snap.

get snap_name key
    Retrieves the value of a configuration option for a snap.

--classic
    Used with install to allow installation of snaps that require 'classic' confinement (less strict security).

--devmode
    Used with install to allow installation of snaps in 'development mode' (no confinement, for debugging).

--channel name
    Specifies the release channel (e.g., stable, candidate, beta, edge) from which to install or refresh a snap.

--revision number
    Specifies a particular revision number to install or revert to.

--no-wait
    Performs the operation in the background and returns immediately without waiting for completion.

DESCRIPTION

The snap command is the primary interface for interacting with the Snap packaging system on Linux. Snaps are self-contained software packages that bundle an application and all its dependencies, ensuring it runs reliably across various Linux distributions. The snap command allows users to install, update, remove, and manage snaps, as well as interact with the Snap Store. It handles package isolation, automatic updates, and rollback capabilities, making software deployment simpler and safer. Snaps are confined using technologies like AppArmor and seccomp, enhancing system security by limiting application access to system resources. This modern packaging format aims to provide a universal solution for distributing Linux applications, similar to app stores on mobile platforms. It integrates deeply with systemd for service management and uses a transaction-based system for updates, ensuring system stability.

CAVEATS

While offering significant advantages, snap also has some considerations:
Confinement Limitations: Snaps run in isolated environments, which can sometimes restrict access to certain system resources, traditional file paths, or interact with other non-snap applications directly without explicit interface connections.
Disk Space Usage: Due to their self-contained nature and the retention of older revisions for rollback, snaps can consume more disk space compared to traditionally packaged applications.
Automatic Updates: Snaps update automatically in the background by default. While convenient, this can occasionally occur at inconvenient times or introduce unexpected changes. Users have limited control over the exact timing of these updates.

<I>CONFINEMENT AND INTERFACES</I>

Snaps are designed to be isolated from the rest of the system for security. This isolation is achieved through confinement (e.g., using AppArmor and seccomp). Communication with the system and other snaps happens via well-defined interfaces. Users might need to manually connect or disconnect interfaces for certain functionalities using snap connect or snap disconnect.

<I>CHANNELS AND REVISIONS</I>

Snaps are distributed via different channels (stable, candidate, beta, edge) which represent varying levels of stability. Users can choose a channel when installing or refreshing a snap using the --channel option. Additionally, the snap system keeps track of revisions for each snap, allowing users to revert to a previous working version if an update causes issues using snap revert.

HISTORY

The snap packaging system was developed by Canonical, the company behind Ubuntu Linux. It was initially introduced in 2014 as a universal package format for Ubuntu Touch and later expanded to desktop Linux, gaining significant adoption from around 2016-2017. The primary motivation was to address the challenges of software distribution fragmentation across different Linux distributions and to provide a more secure, isolated, and automatically updating application delivery mechanism, akin to mobile app stores. Over time, it has become a core component of Ubuntu and is supported on many other Linux distributions, with a growing number of applications available in the Snap Store.

SEE ALSO

apt(8), dnf(8), yum(8), flatpak(1), dpkg(8), rpm(8), snapd(8)

Copied to clipboard