brock

Create Aliases in Ubuntu

13 Oct 2008

If you run the same commands in Linux (or Ubuntu) all the time, you can add what is called an "alias" to your user account. For example, I regularly type:

ls -alh

So I setup an alias so that I can just type la. (also, see my Top 10 Aliases list) To do this, simply edit your "profile". Bash is the program that you typically use when you are in a command shell, so it may be called your "bash profile". Your profile is in your Home folder and stores all of your preferences. Just edit the ".profile" or the ".bash_profile" if it exists.

cd ~
pico edit .profile

Add the following code to the bottom:

alias la='ls -alh'

Now when you are typing at the command prompt, you just type la and it acts like you typed ls -alh. Pretty handy.