Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

I had an alias in my .bashrc and I really don't want it anymore. I erased the alias, but my bash already has this alias loaded.

Can I erase this alias from this bash without logging out?

share|improve this question

marked as duplicate by jasonwryan, vonbrand, uther, Renan, Mat Apr 23 '13 at 4:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
For questions like these, try Google next time. It works. –  mtahmed Apr 22 '13 at 14:51
    
I did... didn't work –  RSFalcon7 Apr 22 '13 at 14:52
    
Oh ... I tried searching on Google using keywords from your question: erase alias bash. It worked. Not a big deal, just a humble suggestion. –  mtahmed Apr 22 '13 at 14:54
    
@mtahmed good for you! Even being not a hard question, this it is a positive thing to the community because now those keywords will most likely end up here. I tried erase alias bash without logout ftw –  RSFalcon7 Apr 22 '13 at 14:59
add comment

3 Answers 3

up vote 4 down vote accepted

by using unalias:

[zak ~]$ alias ls
alias ls='ls --color=auto'
[zak ~]$ unalias ls
[zak ~]$ alias ls
bash: alias: ls: not found
share|improve this answer
add comment

Use the unalias command:

$ alias foo=ls
$ foo
... ls output ...
$ unalias foo
$ foo
bash: foo: command not found
share|improve this answer
add comment

If you have many aliases and wish to clear them all, run unalias -a. Then you can source your .bashrc (or .bash_aliases) file to use the aliases there.

$ unalias -a
$ # '.' is like an alias to 'source'
$ . ~/.bashrc

Sometimes it is desirable to disable an alias temporarily instead of unaliasing it entirely. To do this, put a \ in front of your command.

$ alias foo=ls
$ foo
... ls output ...
$ \foo
bash: foo: command not found
$ foo
... ls output ...
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.