LinuxCommandLibrary

snap

Install, manage, and update software packages

TLDR

View documentation for the packaging solution

$ tldr snap.pkg
copy

View documentation for the European Space Agency Earth observation data processing tool
$ tldr snap.esa
copy

SYNOPSIS

snap [global-options] <command> [command-options] [arguments]

Common usage examples:
snap install <snap-name>
snap remove <snap-name>
snap list
snap refresh <snap-name>

PARAMETERS

install
    Installs a specified snap package from the Snap Store. You can specify a channel (e.g., --channel=beta) or a specific revision.

remove
    Removes an installed snap package from the system. Use --purge to also remove all associated data.

list
    Lists all currently installed snap packages, showing their version, revision, tracking channel, and publisher.

refresh []
    Updates an installed snap package to its latest version available on its current channel. If no snap name is provided, all snaps are refreshed.

find []
    Searches the Snap Store for available snap packages based on a search term. If no term is provided, it lists popular snaps.

info
    Displays detailed information about a specific snap package, including its publisher, description, version, channels, and available interfaces.

run .
    Executes a specific application binary from within an installed snap, allowing access to its confined environment.

connect : :
    Connects a snap interface, granting a snap access to a specific system resource or another snap's feature (e.g., snap connect myapp:camera :camera).

disconnect : :
    Disconnects a snap interface, revoking a snap's access to a previously granted resource.

changes
    Lists recent system-wide changes made by the snapd daemon, such as installations, removals, or updates, with their status.

DESCRIPTION

The snap command-line tool provides an interface for interacting with the snapd daemon, which manages Snap packages. Snaps are self-contained software packages that bundle an application and all its dependencies, ensuring cross-distribution compatibility and consistent operation. They are designed for easy installation, automatic updates, and strong security through confinement (sandboxing). The snap command allows users to install, remove, list, refresh, search for, and manage the lifecycle of Snap applications on their Linux system.

CAVEATS

Snaps can consume significant disk space due to bundling all dependencies, potentially leading to redundant libraries across multiple snaps. They might also exhibit slower startup times compared to native packages because of their confined nature and squashfs mounting. Automatic background updates, while convenient for security, can sometimes be disruptive or undesirable for users who prefer manual control over their system's software versions. Furthermore, strong confinement can occasionally lead to integration challenges with desktop themes or native file dialogs.

CONFINEMENT AND INTERFACES

Snaps run in a strictly isolated environment, or sandbox, by default, which significantly enhances system security. Their access to system resources (like the network, sound, specific file system paths, or hardware) is controlled through interfaces (also known as plugs and slots). These interfaces must be explicitly connected (either automatically upon installation or manually by the user) to grant a snap the necessary permissions, ensuring that applications only access what they genuinely need, thus minimizing potential security risks.

CHANNELS

Snap packages are published to different channels, allowing users to choose the stability level of the software they install or track. Common channels include stable (for production-ready, well-tested releases), candidate (pre-release versions, nearly stable), beta (early access, potentially with bugs), and edge (the latest development version, often unstable). Users can specify a channel during installation (e.g., snap install myapp --channel=beta) or when switching an already installed snap to a different track.

TRANSACTIONAL UPDATES

One of Snap's key features is its transactional update mechanism. This means that updates are atomic: an update operation either completes entirely and successfully, or if any part of it fails, the system automatically rolls back to the previous working version of the snap. This robust process helps prevent software breakage during updates, ensuring system stability and reliability, even in the event of power loss or network interruptions during the update process.

HISTORY

Snap was developed by Canonical, the company behind Ubuntu, and first introduced in 2014 primarily for their Ubuntu Touch mobile operating system. It was later expanded to the desktop Linux environment in 2016 as a universal packaging system. The primary goal behind Snap was to provide a robust, cross-distribution application delivery mechanism that offers transactional updates, strong security through confinement, and ease of deployment for developers.

SEE ALSO

apt(8), dnf(8), yum(8), flatpak(1), appimage(1), snapd(8)

Copied to clipboard