genernal

DBA’s Be Quicker, Use Aliases….

Posted

I have been using aliases in Linux from a long time. But I was teaching a class today and some students asked me to explain it(it was a basic database administration class for newbies). So it’s more a reference about the aliases.

Aliases are short forms of the long commands that one may use in his/her Linux environment. To check that if you have already aliases configured, you can use ALIAS command like below,

 

So here if you type vi, it will open VIM editor for you.

Let’s create an alias for us. We are going to make an alias to jump into Oracle Base without typing the whole command of CD $ORACLE_BASE.

You can see that we used ALIAS command to create an alias called OB. When I typed OB, it shifted my current directory to whatever my Oracle Base location is.

The only glitch is that this alias is a temporary one. As soon as I shall close this session, I won’t be able to use it again.

In order to make a permanent alias, we need to enter this alias entry in our shell configuration file, for example, Bashrc.

Now, let’s save the file and save the entries that we have made in it.

We can see our aliases are in action now,

If you don’t want an alias to be used anymore, remove it from the configuration file or use UNALIAS command to remove all aliases.

For me personally, aliases make the work much faster.

Hope that helps.

Aman….