Friday, February 26, 2016

Using aliases

If you are linux user and new to linux. Aliases can make terimnal your one stop shop for anything.

1. Simple way:

Go to ~/.bashrc

alias willrememberyou='cd gothere; sh runfirstsciprt; cd gosomewhereelse; sh  al'

2. To list aliases use alias and all aliases will be listed.

i.e

alias command will list all aliases in your system
 
3. Use one alias in another

alias anAlias='anotherAlias hello' 
 alias anotherAlias='echo'


4. Unalias

 unalias anotherAlias

Will remove the alias.

5. Session vs permanent aliases

alias anAlias='cd theDir' 
Will only create an alias for the shell session.

If you want to make it permanent,

Put it in ~/.bashrc

To make it available for all users put it in:

/etc/profile

References:http://stackoverflow.com/questions/5137726/creating-permanent-executable-aliases
http://unix.stackexchange.com/questions/12144/does-one-alias-affect-another-alias