---
title: Ubuntu Core – how to enable aliases for your snaps commands
description: We are happy to announce that a new version of Ubuntu Core, based on
  snapd 2.21, has been released to the stable snaps channel yesterday. As with any
  stable release, your Ubuntu Core devices will update and reboot automatically. If
  you are using snaps on the desktop, the release will reach you through a snapd  […]
url: https://canonical-com-2950.demos.haus/blog/ubuntu-core-how-to-enable-aliases-for-your-snaps-commands?format=md
---

1. [Blog](https://canonical-com-2950.demos.haus/blog)
2. Article

---

[David Callé](https://canonical-com-2950.demos.haus/blog/author/davidc3-2 "More about David Callé")

28 January 2017

# Ubuntu Core – how to enable aliases for your snaps commands

[core](https://canonical-com-2950.demos.haus/blog/tag/core)
[Ubuntu Core](https://canonical-com-2950.demos.haus/blog/tag/ubuntu-core)

---

Share the article

We are happy to announce that a new version of Ubuntu Core, based on snapd 2.21, has been released to the stable snaps channel yesterday.

As with any stable release, your Ubuntu Core devices will update and reboot automatically. If you are using snaps on the desktop, the release will reach you through a snapd package update on Ubuntu 16.04, 16.10 and 17.04.

This release comes with several improvements you can read about in [the changelog](https://lists.ubuntu.com/archives/snapcraft/2017-January/002493.html), but let’s focus on a big feature that will help people who snap very large software, especially software that comes with many commands (such as OpenStack, ImageMagick, most databases…) and their users.

## Introducing snap aliases

When you launch a snap from the command line, you need to use the name of the snap, then the name of a command it contains. In most cases, you don’t notice it, because snapd simplifies the process by collapsing `<snap-name>.<command-name>` into `<command-name>`, when both are the same. This way, you don’t need to type `inkscape.inkscape`, but simply `inkscape` and get a familiar software experience.

But when a snap contains multiple commands, with various names, things can become less familiar. If we take the PostgreSQL snap as an example, we can see it comes with many commands: `initdb`, `createdb`, etc. In this case, you have to run `postgresql96.initdb`, `postgresql96.createdb`, etc.

The alias feature of snapd lets snaps declare their own aliases, for users to manually enable after install or for snap stores to declare as “auto-aliases” that will be enabled upon install.

## How to manually enable aliases

To have an overview of all available aliases on a system, you can use the `snap aliases` command. For this example, I’ve installed a modified version of the `postgresql96` snap with aliases for all commands.

```
$ snap aliases
App                            Alias             Notes
postgresql96.clusterdb         clusterdb         -
postgresql96.createdb          createdb          -
postgresql96.createlang        createlang        -
postgresql96.createuser        createuser        -
postgresql96.dropdb            dropdb            -
postgresql96.droplang          droplang          -
postgresql96.dropuser          dropuser          -
postgresql96.ecpg              ecpg              -
postgresql96.initdb            initdb            -
[...]
```

As you can see, the snap now exposes aliases to snapd. They are not enabled yet, but it’s simply a matter of running `snap alias <snap-name> <alias>`. Note that you can pass multiple space-separated aliases to this command.

Let’s enable the `createuser` alias.

```
$ snap alias postgresql96 createuser
$ snap aliases | grep createuser
postgresql96.createuser        createuser        enabled
```

I can now ensure that there is indeed a `createuser` command coming from a snap:

```
$ which createuser
/snap/bin/createuser
```

And of course, run it:

```
$ createuser --help
createuser creates a new PostgreSQL role.
```

To disable an alias you can use the `snap unalias` command.

## How to declare aliases

Declaring a new alias in your snap is as easy as adding an `aliases` entry to your snapcraft.yaml `apps` keys. Let’s look at the `createuser` command in our snap:

```
[...]
apps:
  [...]
  createuser:
       command: usr/bin/createuser
       plugs: [network]
       aliases: [createuser]
[...]
```

And build your snap as usual with `snapcraft`, `snapcraft cleanbuild` or let it flow through your CI.

See the full example for this snap in [this pull request](https://github.com/commandprompt/postgresql-snap/pull/44).

That’s it, heads-on to [tutorials.ubuntu.com](https://tutorials.ubuntu.com) to make your own snap from scratch and give aliases a try!

[Get in touch

Interested in running Ubuntu in your organization?](https://ubuntu.com/about/contact-us/form)

## Sign up for our newsletter

Get the latest Canonical news and updates in your inbox.

Work email:

\*I agree to receive information about Canonical's
products and services.

By submitting this form, I confirm that I have read and agree to [Canonical's Privacy Policy](https://canonical-com-2950.demos.haus/legal/dataprivacy).

Sign up

## Share on

---

## Related posts

[### So you need to add microcontrollers to your fleet: now what?](https://canonical-com-2950.demos.haus/blog/microcontrollers-ubuntu-core-golioth)

Your Ubuntu Core fleet is running beautifully. OTA updates roll out in minutes. Every device is strictly confined, cryptographically attested, and carrying a 10 to 15 year long...

[Jonathan Beri](https://canonical-com-2950.demos.haus/blog/author/jmberi)

18 June 2026

[### A look into Ubuntu Core 26: Building a local AI inference appliance in a virtual machine](https://canonical-com-2950.demos.haus/blog/ubuntu-core-26-ai-box)

Welcome to this blog series which explores innovative uses of Ubuntu Core. Throughout this series, Canonical’s Engineers will show what you can build with this Core 26 release,...

[Gabriel Aguiar Noury](https://canonical-com-2950.demos.haus/blog/author/g-aguiar-noury)

16 June 2026

[### A look into Ubuntu Core 26: Deploying AI models on Renesas RZ/V series for production](https://canonical-com-2950.demos.haus/blog/ubuntu-core-26-ai-renesas)

Welcome to this blog series which explores innovative uses of Ubuntu Core. Throughout this series, Canonical’s Engineers will show what you can build with our releases,...

[Gabriel Aguiar Noury](https://canonical-com-2950.demos.haus/blog/author/g-aguiar-noury)

4 June 2026

[### A look into Ubuntu Core 26: Cloud-powered edge computing with AWS IoT Greengrass and Azure IoT Edge](https://canonical-com-2950.demos.haus/blog/ubuntu-core-26-cloud-integration)

Welcome to this blog series which explores innovative uses of Ubuntu Core. Throughout this series, Canonical’s Engineers will show what you can build with this Core 26 release,...

[Gabriel Aguiar Noury](https://canonical-com-2950.demos.haus/blog/author/g-aguiar-noury)

20 May 2026
