How does alias work in Unix?

We use alias in Unix to give a short name to a long command. We can even use it to combine multiple commands and give a short convenient name.

E.g. alias c=’clear’

With this alias we just need to type c for running clear command.

In bash we store alias in .bash_profile file.

To get the list of all active alias in a shell we can run the alias command without any argument on command line.

% alias
alias h=’history’
alias ki=’kill -9′
alias l=’last’

Read the full book at www.amazon.com
Posted in Unix, Unix Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *

*