2

Say I have set up a few aliases for long bash commands:

alias test1='long-command-1'
alias test2='long-command-2'

and so on. Is it possible to list all aliases currently defined (ideally with the command it is an alias for)? Is it possible to undefine (remove) an alias?

AlainD
  • 849

1 Answers1

10

To list all the aliases defined in the system, open a terminal and type alias. It lists each alias and the command aliased to it.

As for removing an alias permanently, you can do this by opening your .bashrc file (in your home folder) with any text editor and and removing (or commenting out, by placing a # in front of them) the lines corresponding to the alias you want to remove. For the removal to take effect, you will need to close the terminal and open a new one or open a new bash shell by typing bash.

If, however, you want to remove the alias temporarily, you just do unalias test1 and this will remove the alias for test1. Remember, if you do it like this, alias test1 will be there again the next time you open a terminal if it is defined inside your .bashrc.

Juan Antonio
  • 1,572