brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: snap alias gives a snap command the name you want to type

Snap
~/tips/tip-snap-alias-short-command

sudo snap alias vlc my-vlc

Create your own command name for an app installed as a snap.

Snap commands sometimes have awkward names, especially the ones with a dot in them. An alias lets you pick something shorter.

The form is the app first, then the new name. This is the example from the snap docs:

sudo snap alias vlc my-vlc
snap aliases vlc

The new command lands in /snap/bin, so it works for every user and inside scripts. A shell alias in your .bashrc only works for you in interactive shells, which is the main reason I would use the snap version.

The original command keeps working next to it. To remove your alias:

sudo snap unalias my-vlc

snap aliases without a name lists them all, including the ones that were set up automatically by the store. Look there when a command name seems to come from nowhere.

Choose a name that does not already exist on the system. If an apt package later installs a program with the same name, which one runs depends on the order of your PATH, and that makes for a confusing hour. Also, do not unalias the snap’s name as a whole unless you mean it, because that disables its default aliases too.

Further reading: Snapcraft: Apps and aliases

More Snap tips snap refresh --list sudo snap save lxd snap services sudo snap stop --disable lxd.daemon snap saved All Snap tips (14) All topics

Link