Ubuntu – the correct way to create alias to snap package in Ubuntu 16.04

aliasbashcommand linesnap

TL;DR

How to create system wide alias to snap package in Ubuntu 16.04?

More details

I would like to install Blender as a snap. I found, that there is blender-tpaw package which can be installed. Unfortunately after installing it, it is available in terminal under name blender-tpaw, not blender.

Using snap alias

So first of all I've tried to run command sudo snap alias blender-tpaw blender, according to: https://insights.ubuntu.com/2017/01/28/ubuntu-core-how-to-enable-aliases-for-your-snaps-commands/. But this is what I've got:

error: cannot perform the following tasks:
- Enable aliases for snap "blender-tpaw" (cannot enable alias "blender" for "blender-tpaw", no such alias)

Create symbolic link in /usr/local/bin

Then I've tried to make symbolic link sudo ln -s /snap/bin/blender-tpaw /usr/local/bin/blender but in this case very strange thing happen: now when I type blender in a terminal I've got output of snap command…

Put alias in /etc/profile.d

I've also tried to create alias in /etc/profile.d/alias.sh

alias blender='blender-tpaw'

But this work only, on my Ubuntu 16.04 Server, but doesn't work in Ubuntu 16.04 Desktop.

What I want to achieve?

I want that this alias will be system wide, for all users, without changing manually .bashrc for each user separately. And I want the same way working on Ubuntu Server, and Ubuntu Desktop as well.

Best Answer

Whatever problem was encountered last year when trying to register the alias now seems fixed. The same sequence worked on 16.04, and the nearly released 18.04 as well. Versions uses are in the output.

$ sudo snap install blender-tpaw
[sudo] password for dpb: 
blender-tpaw 2.78c-tpaw0 from 'tpaw' installed
$ sudo snap alias blender-tpaw blender
Added:
  - blender-tpaw as blender
$ sudo snap aliases
Command                  Alias         Notes
aws-cli.aws              aws           -
blender-tpaw             blender       manual
conjure-up.conjure-down  conjure-down  -
lxd.lxc                  lxc           -
$ snap version
snap    2.32.3.2+18.04
snapd   2.32.3.2+18.04
series  16
ubuntu  18.04
kernel  4.15.0-15-generic

References:

Related Question