From f2be2742bb03a94baa4ef36aebac4de3c375ad30 Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Thu, 28 Apr 2022 00:32:32 +0200 Subject: [PATCH] Added snap notes to the knowledge base --- knowledge base/snap.md | 100 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 knowledge base/snap.md diff --git a/knowledge base/snap.md b/knowledge base/snap.md new file mode 100644 index 0000000..a755f5b --- /dev/null +++ b/knowledge base/snap.md @@ -0,0 +1,100 @@ +# Snap + +## TL;DR + +```shell +# Find snaps. +snap find chezmoi +snap find --private boincstats-js +snap search vscode + +# View detailed information about snaps. +snap info snapd + +# Download snaps and their assertions without installing them +snap download constellation + +# Install snaps. +sudo snap install karuta +sudo snap install code-tray --channel=beta +snap ack foo.assert && snap install foo.snap +snap install --dangerous foo.snap +snap install --devmode foo +snap install --classic foo + +# List installed snaps. +snap list +snap list --all + +# Manually update snaps. +sudo snap refresh +sudo snap refresh awdur +sudo snap refresh mist --channel=beta + +# Revert snaps to a prior version. +sudo snap revert widl-nan +sudo snap revert bunyan --revision 5 + +# Remove snaps. +sudo snap remove runjs + +# Remove all old revisions of all installed snaps. +snap list --all \ + | grep disabled | awk '{print $3, $1}' \ + | xargs -I {} -t sh -c "sudo snap remove --purge --revision {}" + +# Log in/out to/from snap. +sudo snap login +snap logout + +# View transaction logs. +snap changes +snap change 123 + +# Watch transactions. +snap watch 123 + +# Abort transactions. +snap abort 123 + +# View available snap interfaces. +snap interfaces + +# Connect a plug to the ubuntu core slot. +snap connect foo:camera :camera + +# Disconnect a plug from the ubuntu core slot. +snap disconnect foo:camera + +# Disable snaps. +snap disable foo + +# Enable snaps. +snap enable foo + +# Set a snap's properties. +snap set foo bar=10 + +# Read a snap's current properties. +snap get foo bar +``` + +## Manage revisions + +```shell +# List installed snaps with all their revisions. +snap list --all + +# Remove all old revisions of all installed snaps. +snap list --all \ + | grep disabled | awk '{print $3, $1}' \ + | xargs -I {} -t sh -c "sudo snap remove --purge --revision {}" +``` + +## Further readings + +- [cheat.sh] +- [Managing Ubuntu snaps] + +[cheat.sh]: https://cheat.sh/snap +[managing ubuntu snaps]: https://www.freecodecamp.org/news/managing-ubuntu-snaps/