How do I get Bash to reread the bashrc file?
Hi, I have a quick question regarding the Bash shell and bashrc file. If I make some changes to my bashrc file, is there a way of making Bash reread the file without quiting and restarting my terminal emulator?
Thanks in advance will103 |
. .bashrc
(not the space between the two dots) It reads it and applies the changes to the active shell. |
not "not", "note"
|
Tried that but no luck. If I add an alias to my .bashrc then run the command
. .bashrc It doesn't recognise the alias. "source ~/.bashrc" didn't work either. Thanks will103 |
Open a new terminal session...
|
...no more ideas here. Have you checked if it excecutes the .bashrc, say via an echo "whatever" somwhere in the script?
|
i'm pretty sure "source ~/.bashrc" will work.
but it appears a problem. try reinstalling bash. |
. ~/.bashrc works for me. Give that a try.
|
Or you could run /bin/bash. You will be running a new shell. (a subshell actually)
Since alias definitions need only be defined once, .bash_login or .profile would be better places to put them. Some distros source a ~/.aliases file from /etc/profile if it exists. |
Depending on the term emulator your using .bashrc might not be the file your emulator looks to for user preferences. For instance I'm using gnome (gnome-terminal) and I couldn't figure out why putting stuff in my .bashrc didn't change anything (before this I was strictly CLI only). One of my friends suggested that I make a softlink to point .bash_profile -> .bashrc .
If source .bashrc and . .bashrc don't work I'd try creating a softlink from .bash_profile -> .bashrc . |
Thanks for all of your suggestions. I will give them a try.
Cheers will103 |
I know that this is an old thread, but wanted to clarify the fact that:
. .bashrc works correctly if executed from the directory where bashrc resides (home), if you are not in that directory then you need: . ~/.bashrc , which is essentially the same, but with a path to the home directory provided. Thanks, Vlad |
All times are GMT -5. The time now is 11:52 AM. |