Friday, November 13, 2009

Creating Permanent Aliases

I am too lazy to type long commands like "ssh username@remote_server_addres" ..etc...So Aliases came to help me..Now i just type 'aaa" to login to server..Ya it's true..commands make the life simpler..

So how to do this ? here you go..

1) gedit ~/.bash_aliases

Opens the file .bash_aliases [ even if it is not there now]

2) Type all aliases you want to give here..

alias any_name='ssh username@remote_address'

and save it

3) gedit ~/.bashrc

opens the .bashrc file

4) find following lines

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi


5) If you got the above lines, uncomment it ( remove the # at the begining ,if any).

DONE..start a new terminal and type the name you gave as alias any_name,,it will connect to your server..
You can do this for any commands..like if u always want to list all files and folders(including hidden) in the current direcotry you do ls -a. In such case, create alias named ls as 'ls -a'..So typing ls will list hidden also.


Njoy.