The alias command assigns a command or set of commands to a string. Aliases are generally used to simply typing a long command or to execute an option to a command by default.
$ alias aelog='tail -f /var/log/apache2/error.log'
$ alias rm='rm -i'
Now, when we type the command aelog on commandline, it would run tail -f /var/log/apache2/error.log. This is a time saving technique. rm deletes without asking for confirmation. Since we generally like to confirm before deleting anything, creating the alias on second line would now cause the -i option to run by default. The -i option requires the user to confirm the deletion of every single file and directory.
List aliases
To see a list of aliases in your system, type the alias command
$ alias
output
alias aelog='tail -f /var/log/apache2/error.log'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'
alias rm='rm -i'
Making your aliases permanent
When you restart your computer, your aliases are lost. To solution to avoid this annoyance is to write your aliases in ~/.bashrc or the rc file of your shell if you are using another shell. Restart you command terminal and your aliases would work.
Removing aliases
To remove an alias, use the unalias command.
$ unalias aelog
If your aliases are written in your ~/.bashrc, an alias removed by unalias would reappear after reboot. To remove it permanently, delete the alias form ~/.bashrc file.