Sign up ×
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 a new alias in .bash_aliases file or a new function in .bashrc file, is there some refresh command to be able immediately use the new aliases or functions without closing the 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
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 19 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
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='' . I have to close terminal. – xralf Oct 20 '11 at 11:49

Typing . ~/.bashrc at the command line will run .bashrc and so any functions defined in that file will be created.

.bashrc itself will then also call and run .bash_aliases (if it exists) if .bashrc has this code in it:

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

whereas using . ~/.bash_aliases alone (at the command line for example) will just try and run .bash_aliases without involving .bashrc and will give an error if the file doesn't exist (hence the file check test when in .bashrc).

share|improve this answer

Your Answer


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.