Running a snap

Snaps integrate with desktop environments, so a typical graphical snap will place one or more icons in the menu or launcher on any modern distribution. If a graphical snap does not have an icon, this is a bug and should be reported to the snap publisher or to the snapd developers on the snapcraft forum.

For non-graphical applications, or as a preference, snaps can be run from the command line too. The snap info command lists the executable programs contained inside the snap.

$ snap info mgba
  - mgba
  - mgba.mgba-qt

The commands listed are exposed to the host OS. Typically the ‘main’ command used will match the name of the snap, and as such can be executed directly. In the above example as the snap name is mgba and the command is also mgba, the user can just type mgba in a terminal to run the program.

$ mgba --version
 mgba 0.6.1

Snaps can also be run using snap run.

$ snap run mgba --version
 mgba 0.6.1

By default any commands which are not named the same as the snap will be namespaced. So to run the mgba-qt command in the mgba snap, users need to run mgba.mgba-qt (as shown in snap info above). However a developer can request an alias for their snap to be asserted in the store such that users only need to run the aliased command, without the namespace. Once approved and set, users are able to run the aliased command, such as mgba-qt in this example.

$ mgba-qt --help
usage: mgba-qt [option ...] file

Generic options:
  -b, --bios FILE            GBA BIOS file to use
  -c, --cheats FILE          Apply cheat codes from a file
  -C, --config OPTION=VALUE  Override config value
  -d, --debug                Use command-line debugger
  -g, --gdb                  Start GDB session (default port 2345)
  -l, --log-level N          Log level mask
  -v, --movie FILE           Play back a movie of recorded input
  -p, --patch FILE           Apply a specified patch file when running
  -s, --frameskip N          Skip every N frames
  --version                  Print version and exit