Thursday, December 3, 2009

setting a command shortcut in linux

The alias command helps to create your own custom shortcut name to a linux command. The format is -
alias name='command'
An example alias view all hidden files -
alias lh='ls -la'
An example alias to cd to the webserver root -
alias webroot='cd /usr/local/apache2/htdocs'
An example alias to run php in CLI mode -
alias php='/usr/local/apache2/php/bin/php'
To list all the available aliases, just type alias on the command line.

If you would want the aliases to be available everytime/forever, add them to your .bash_profile