I find myself having many terminals open at once all the time. When I update my .bashrc, I have to go to each terminal and execute
. .bashrc
to source the terminal with the new .bashrc.
This is kind of a pain and also time consuming. I was wondering if there is a way of sourcing all open terminals with the new .bashrc file without going to each one or logging out and starting over?
Best Answer
terdon's approach works well under the right circumstances, but if, e.g., .bashrc appends to the PATH variable, it will cause errors rather quickly.
Instead of simply resourcing the file, you could check its modification time first and compare it to the mtime of the last sourced version.
To do so, append this to ~/.bashrc:
Linux
OS X and BSD
Then, resource it manually one final time.