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.

When I define new alias in .bash_aliases file or new function in .bashrc file is there some refresh command to be able immediately use the new aliases or functions without closing terminal (in my case xfce4-terminal with a few tabs open, many files open and in the middle of the work)?

share|improve this question
3  
Note that there is no command that will made that new command known in all your open terminals/tabs. You'll have to do the . .bashrc or source .bashrc in every shell you have open. –  Paul Tomblin Oct 19 '11 at 12:05

2 Answers 2

up vote 14 down vote accepted

Sourcing the changed file will provide access to the newly written alias or function in the current terminal, for example:

source ~/.bashrc

An alternative syntax:

. ~/.bashrc

Note that if you have many instances of bash running in your terminal (you mentionned multiple tabs), you will have to run this in every instance.

share|improve this answer
2  
source is csh-derived. The bourne shell way is . .bashrc. –  Paul Tomblin Oct 19 '11 at 12:04
    
That's interesting that this doesn't work when I define alias prg='prg.py' . I have to close terminal. –  xralf Oct 20 '11 at 11:49

. ~/.bashrc will run .bashrc By default .bashrc will also call and runs .bash_aliases with:

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

whereas

. ~/.bash_aliases alone will just run .bash_aliases

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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