Create permanent aliases at Ubuntu

A very handy and time-saving facility when using the terminal, is to use alias for any command that you use most of the time.

For example, at my system I have these aliases:

  • c == clear (also, a great keyboard shortcut exists: Ctrl + L)
  • e == exit
  • ls == ls -l –color=auto (flags explained below)

So if I want to clear the screen I only type “c”, hit enter…

So, to create an alias, let’s say for ls to print the output as a list and appending to the filename the indicators (one of */=>@|), you open your terminal and type:

Now, when you type ls you can see some more info (and some colors as well, depending on your choice above).
If you exit the terminal and open another, typing ls will give the default behavior of ls, without the -F and –color settting.

So now, we are going to see how to make these aliases permanent.

You will need to type the aliases you need into the .bash_aliases file located in your home directory, in the exact fashion you typed the aliases above, separating them with a newline.
This file is loaded at each new terminal session by the ~/.bashrc file.

And that’s it!

Leave a Comment

Your email address will not be published. Required fields are marked *