Use unalias to remove an alias. Give unalias as a command using the alias to remove as an argument. The alias will be removed for the rest of the shell session. One can also re-alias in the same shell as usual.
Example…
Remove an alias for ls…
$ unalias ls <Enter>
If the alias is set in one’s .bashrc or .bash_profile the above will remove the alias but only for the current shell session. To remove the alias from all future shell sessions edit said file by removing the line where the alias is defined.
One can list aliases in the current shell by simply runing alias without any arguments.
Example…
List aliases in the current shell…
$ alias <Enter>
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.