Gaurav's Blog

return rand();

Aliases

| Comments

If one uses the terminal quite a lot, it is essential that one finds out fast ways of doing routine stuff. Aliases are one of the many tricks in the hat.

Here is how you can set up a bash alias:

alias smallcmd='very long and verbose command'

You can then type

smallcmd

and it will replace it by the longer version. To make this permanent, add the aliases to the end of your .bashrc file.

I have even aliased ‘git pull’, ‘git push’, ‘git commit’, and ‘git status’ to three letter mnemonics, which are really handy since I do a lot of work using git.

Secondly SSH aliases are something I didn’t know, until very recently. Instead of typing long unwieldy username and hostnames, one can simply add an alias for the machine in their SSH config file, usually in (~/.ssh/config). For example:

Host ubuntuvm
  HostName 172.16.29.143
  User reddragon

Now, I can just do

ssh ubuntuvm

to SSH to my Virtual Machine!

Comments