How to bring ".bashrc" in effect without logging out or Restarting the current session?

I am basically using .bashrc for adding environment variables. Each time I add a new Environment variable, I have to log out the current session and log in again to bring the changes in effect.

Is there any way where I can add environment variable and continue working without restarting the session ?

[I think I am clear with my question. If more information is needed, please let me know]

Any help is highly appreciated. :)

(Ubuntu 14.04 - 32-bit)

2 Answers

Try source ~/.bashrc, or . ~/.bashrc. Both are the same in bash, and will update you ENV variables.

Example:

export $FOO=bar
echo $FOO
bar
echo "FOO=test" >> ~/.bashrc
. ~/.bashrc
echo $FOO
test
1

If they are terminal releated (like archey or alias commands etc) you can do exit. Else you need to relog.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like