Context
I would like to list the installed snaps on my machine, together with their channel information (<track>/<risk>/<branch>
). My intention is to store that data in a file, so that I can somehow reinstall the same snaps on a new system.
Issue
The built-in command snap list
seems to be geared towards printing data to a human being, and to not have options to tweak its output to have a complete dump of some fields.
So I have a nice display ("nice" as in "pleasant to the eye") :
$ snap list
Name Version Rev Tracking Publisher Notes
firefox 106.0.5-1 2067 latest/stable mozilla✓ -
snap-store 41.3-64-g512c0ff 599 latest/stable/… canonical✓ -
...
but I don't know how to restrict this to, say, Name / Tracking
(note: I know that part is just a awk '{ print $1, $4 }'
one liner), or how to have the complete track specification rather than …
in snap-store ... latest/stable/…
.
I also tried looking around for where snap
stores its configuration files (e.g: the ones that say: firefox
should be updated from latest/stable
), but I could not find config directory /etc/snap<something>
, I had no luck looking at man snap
or snap help *
.
I started looking at dpkg -L snap
to have a view of what directories/files could possibly be involved with snap, but I figured I would better ask rather than start reverse engineering on my own.
My Question
How can I get a list of installed snaps on my system, together with the detailed track information ?
Bonus if I can get this using only snap
commands, but using common cli tools (find, awk, grep, jq ...
) to get this from plain files on disk is acceptable too.
extra info :
$ snap --version
snap 2.57.5+22.04
snapd 2.57.5+22.04
series 16
ubuntu 22.04
kernel 5.15.0-52-generic