What’s in a snap?

Snaps are several things, all at once. They are confined, standalone Linux applications that bundle all their necessary dependencies, which means they do not need to rely on the underlying system, and can run independently of it. Snaps are also packaged as compressed Squashfs filesystems, using the .snap extension. For most users, they are an abstraction to get software on their Linux distro, in a simple, straightforward manner. But you may wonder, what lurks inside?

Unpacking the squashFS filesystem

If you want to check the contents of a snap, you can. First, download it, then extract the snap using the unsquashfs tool on the command line. A large number of Linux distributions should have this utility installed, or available in the archives, and should support the compression methods used for snaps (xz and lzo).

snap download “snap name”
unsquashfs “snap name”

Without any other arguments provided, the snap (with the .snap extension) will be uncompressed into a folder named squashfs-root in the current working directory.

unsquashfs kblocks_79.snap
Parallel unsquashfs: Using 8 processors
563 inodes (697 blocks) to write

[=========================================|] 697/697 100%

created 500 files
created 166 directories
created 62 symlinks
created 0 devices
created 0 fifos

The contents of a snap

To allow applications to run independently of the underlying system, snaps create an isolated environment for the contained applications. For strictly confined snaps, the application will see the base snap as its root filesystem, and thus expect to see the traditional layout of folders inside its environment. Typically, the squashfs-root will contain different folders like /bin, /lib, /usr, and others.

drwxr-xr-x  9 igor igor 4096 Mar  9 14:49 ./
drwxrwxrwx 11 igor igor 4096 Mar 23 12:21 ../
drwxr-xr-x  5 igor igor 4096 Mar  9 14:48 etc/
drwxr-xr-x  2 igor igor 4096 Mar  9 14:48 kf5/
-rwxr-xr-x  1 igor igor 8428 Mar  9 14:43 kf5-launch*
-rwxr-xr-x  1 igor igor 3783 Mar  9 14:43 kf5-locale-gen*
-rwxr-xr-x  1 igor igor  191 Mar  9 14:43 kf5-portal-launch*
drwxr-xr-x  3 igor igor 4096 Mar  9 14:48 lib/
drwxr-xr-x  2 igor igor 4096 Mar  9 14:48 lib64/
drwxr-xr-x  3 igor igor 4096 Mar  9 14:49 meta/
drwxr-xr-x  3 igor igor 4096 Mar  9 14:49 snap/
drwxr-xr-x  5 igor igor 4096 Mar  9 14:48 usr

Some of the paths will be obvious and familiar. Some, including various files, will be different.

Application entry point

When developers package snaps, they need to declare the application name and command in the snapcraft.yaml file. For the most part, there is no strict requirement how these should be specified, and the developers can use any variation they like. The application command does not have to be identical to what it could look like using the traditional Linux packaging.

Furthermore, snapcraft also helps the developers create some of the necessary application runtime environment elements, including different variables and relative paths. You can inspect what this setup looks like by checking any script available inside the snap.


This folder contains various setup and declarative files that describe the snap’s behavior. It can include several components: snap.yaml file that contains the basic snap details, a list of plugs and slots, any daemons, and more; hooks that are triggered on specific events; GUI elements like icon files and desktop files for the snap.


The snap directory (if present) can contain the command-chain declaration, a list of commands that are run before the actual application(s) bundled inside the snap. This can help set up the environment that snaps need, without having to resort to convoluted use of wrapper scripts.

And more…

Your snap (or a snap) could have only a handful of folders, or a whole range of them, including custom paths and structure. The contents will differ from one application to another, but at the end of the day, there is no great mystery about what snaps are. Anyone can download, unpack and inspect any snap, and see exactly what they do. In many cases, you will have an exact trail of environment variables and commands that run. If you want to learn a bit more about what else to expect inside a snap, you may want to check the snap format documentation for other useful details.

Finally, if you want to experiment, you can try the handy snap try command – to make quick, live changes to snaps, and test modified behavior. This can be quite useful if you want to speed up your development. That’s all we had today. If you have any comments or suggestions, please join our forum for a discussion.

Photo by Michael Longmire on Unsplash.

Ubuntu desktop

Learn how the Ubuntu desktop operating system powers millions of PCs and laptops around the world.

Newsletter signup

Select topics you're
interested in

In submitting this form, I confirm that I have read and agree to Canonical's Privacy Notice and Privacy Policy.

Related posts

Should you ever reinstall your Linux box? If so, how?

Broadly speaking, the Linux community can be divided into two camps – those who upgrade their operating systems in-vivo, whenever there is an option to do so...

How to make your first snap

Snaps are a way to package your software so it is easy to install on Linux. If you’re a snap developer already or you’re a part of the Linux community, and...

How does Ubuntu 16.04 entering Extended Security Maintenance (ESM) affect snap publishers?

At the end of April, Ubuntu 16.04 LTS will reach the end of its five years of mainstream support and enter the Extended Security Maintenance (ESM) phase. If...