Here are some steps for creating aliases and a few example aliases I have found useful to add to Terminal.app in Mac OS X. You should try to add an alias for tasks that you find repeating often. This tutorial also briefly covers how to use the command line editor Vim.

Set up an alias

Here is a common alias that gets setup to map ls -l to the command ll. So instead of typing ls -l all the time, you can simply type ll to list the contents of the current working directory with the -l flag.

1.

Launch Terminal.app and navigate to your home directory by typing:

cd ~

2.

You will now edit your .bash_profile file with Vim to set up the alias. Launch Vim by typing:

vim .bash_profile

3.

There may already be some lines of text in this file when you open it. Use the arrow keys to go down to a blank line of text. When your cursor is on a blank line of text press the 'i' key to go into insert mode. You can now insert text into the file.

4.

To add an alias, add this line of text:

alias ll='ls -l'

5.

To save the file, you need to get out of insert mode by pressing 'escape'. Then you can issue the command to save the file and close Vim by typing

:x

6.

You can now launch a new terminal window or tab and type

ll

To see your alias in action.

Alias with arguments

To add an alias where you want to accept arguments, the syntax is slightly different. Instead of defining a new alias in your .bash_profile file, you will want to define a new function using the syntax:

function docs {
cd ~/Documents/Docs/"$1" ;
}

This will create an alias called docs that accepts an argument that replaces the $1 placeholder

Alias to open current working directory in Finder

A simple alias I set up opens the current directory in a new Finder window

alias o='open .'

Alias to open application such as Fraise.app

If I want to edit a file in a graphical editor such as Fraise, I set up the alias

alias fraise='open -a Fraise.app'