Creating permanent executable aliases Creating permanent executable aliases shell shell

Creating permanent executable aliases


Add the command to your ~/.bashrc file.

To make it available to all users, add it to /etc/profile.


  • Different shell uses different dot file to store aliases.
  • For mac, the bash shell uses .bash_profile or .profile
  • For ubuntu, the bash shell uses.bashrc
  • If you are using zsh shell and ohmyzsh plugin, the dot file is .zshrc

Traditionally, to add a permanent alias, you need to open the dot file and write alias manually like:

alias hello="echo helloworld"

And remember to source the dot file to have it take effect. To source the dot file on ubuntu's bash, type source .bashrc To make the alias available to all users, write to /etc/profile instead of the dot file. Remember to type source /etc/profile for the new alias to take effect.

If you simply want a temporary alias, you do not need to write to dot file. Simply type that same command (alias hello="echo helloworld) on the terminal.

Note that a temporary alias created through the alias command will disappear once the shell is closed.


If you are looking for a single command to generate aliases without open the text editor, read on.

If you have ruby installed on ubuntu, you can create permanent alias with a single command using aka.

gem install aka2

For example:

aka generate hello="echo helloworld" #will generate a alias hello="echo helloworld" aka destroy hello #will destroy the alias helloaka edit hello #will prompt you to edit the alias.

With aka, there is no need to write to the dot file with a text editor. And no need to source the dot file too.


You're going about this the wrong way.

Either add /Applications/MAMP/Library/bin/ to your path, or create a script to invoke MySQL and place it in a bin directory which is already in your path.