alias is the utility to assign an alias for a command. Follow alias with the name of the alias, the equal sign (=) and a quoted string the alias will reference.
Example…
Use “bye” as an alias for exit…
$ alias bye=”exit” <Enter>
bye now becomes the alias for exit in the current shell. Thus giving the alias bye will run the exit command.
Arguments and options may also be included in an alias.
Example…
Alias ls such that in a color terminal the output will be color coded…
$ alias ls=”ls –color=auto”
This will alias the ls command with its option to include color output where it is supported by hardware.
Observe that options and arguments can still be passed to an alias as if they were being typed explicitly without the alias.
To use the original explicit command after an alias has been set one must give the full path to it.
Example…
Run ls -al explicitly even though it has been aliased to another value in the current shell…
$ /bin/ls -al
Observe that if you want an alias to persist in your shell between sessions it must be included in .bashrc located in ones home directory.