Somewhat of a novice here. I recently installed the flatpak Brave browser and since it's tedious to write flatpak run com.brave.Browser
every time to run it from the terminal, I tried to create an alias using alias brave-browser="flatpak run com.brave.Browser"
. This works just fine for the instance, but when I open up a new terminal and type in the alias I get: brave-browser: command not found
. This also happens with every other application I tried this with. What am I missing?

- 135
1 Answers
When you create an alias it will only function within that terminal.
You need to edit your .bashrc
file which is in your home directory - add the alias to that file and it will be available on an ongoing basis (you'll need the terminal to 'read' the .bashrc
file once you've edited the file - either close the terminal and open another (which will read the file), or type . .bashrc
to force bash to read it.
There are a number of simple text editors - I use nano as it's very simple.
Make a copy of .bashrc in case you mess it up (eg cp .bashrc .bashrc-backup
)
Then type nano .bashrc
You can then find a bit of the file with some aliases and add yours as a new line under some of the others (you can put it anywhere within the file but for human readability / order it is sensible to place it near other aliases).
Then save the file ('write out') by Ctrl
+ o
Then exit with Ctrl
+ x
If you mess it up, delete the damaged version (rm .bashrc
) and restore it from your backup: you do that by 'moving' the file from its current location to the same location with a new name (mv .bashrc-backup .bashrc
)
Of course, if you have a preferred text editor use that instead.

- 2,292
-
-
1As a small tip, nano will also save directly (without prompt) with Ctrl+S. So Ctrl+S Ctrl+X is the quick way to exit while saving the file. This is the perfect answer for the question as asked, but for flatpaks, I would rather install a symbolic link in
/usr/local/bin
that points to/var/lib/flatpak/exports/com.brave.Browser
– vanadium Jun 28 '22 at 15:35
bash
shell in your terminal, then see How do I create a permanent Bash alias? – steeldriver Jun 28 '22 at 13:14