I frequently edited the .bashrc
file to export new environment variables.
Rather than close the console and start a new one to refresh the env variables, is there a convenient way to refresh?
I frequently edited the .bashrc
file to export new environment variables.
Rather than close the console and start a new one to refresh the env variables, is there a convenient way to refresh?
Within the same window, you can simply type bash
to start a new one. This is equivalent to closing the window and re-opening a new one.
Alternatively, you can type source ~/.bashrc
to source the .bashrc
file.
source
. you can just type dot instead of it: . ~/.bashrc
.
– rush
Dec 13 '11 at 6:31
source
shows the user which command is called. I don't believe in showing the shorthanded commands to new users until they understand what the code is doing.
– n0pe
Dec 13 '11 at 6:34
source
is a bashism that is longer to type yet offers no advantages over its portable across all shells equivalent, .
, I don't see the point of encouraging anyone, new or experienced, to use it.
– jw013
Dec 15 '11 at 2:27
In addition to what others have suggested, I have found out that source
won't unset the previously assigned environment variables. So, if you want to unset environment variables, you have to do it manually.