Create your own commands using alias

In Unix based operating systems it is quit easily create your own convenient commands using alias. This is particularly helpful when you use certain shell commands in a regular basis. To create alias
list you should create or edit ~/.bashrc. Here is how you do it.

Open the Terminal.app

cd
vim .bashrc

If the file exists you can scroll down to the bottom and press i to insert some aliases

alias la = 'ls -al'
alias ll = 'ls -l'
alias dfile = 'rm -f'
alias dfolder = 'rm -rf'
alias md = 'mkdir'
alias v = 'vim'
alias c = 'clear'

Hit Esc, type :wq and hit Return to exist Vim editor.
The above aliases to be binding, you have to start the Terminal.app

If you want to check the existing aliases, type alias and hit Return.
You can temporarily deactivate an alias using unalias command.

Eg. unalias la would temporarily deactivate la alias that I previously created.

Share and Enjoy:
  • Digg
  • del.icio.us
  • MisterWong
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati

Leave a Reply

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>