Bashrc is a configuration settings file that is loaded whenever we log into Linux bash shell. It consists of all settings such as environment variables and other parameters required to help users work easily in bash shell. You can also include scripts to be run at the time of system boot. You can also set JAVA_HOME (for working with Java apps), use bash aliases to create your own custom command, manage Bash environment variables like PATH, etc. But every time you make changes to this bashrc file, you need to reload it in order to apply changes. Typically, users log out of their session and log back in to apply changes. This is tedious and can be avoided. In this article, we will learn how to reload bashrc settings without logging out and back in.
How to Reload Bashrc settings Without Logging Out and Back In
Here is the default location of bashrc file.
It is unique for each user and changes made in the bashrc file of one user does not affect other users. The reason why you need to reload bashrc file after making changes to it, is that this file is read only once at start of shell session. It does not read it again afterwards unless you explicitly tell Linux to do so.
You can easily make changes to bashrc file by opening it in any editor.
$ vi ~/.bashrc
After you have made the required changes to it, you can save and close the file. At this point, the changes won’t be applied.
Thereafter, reload the bashrc file using the following command. Only then the changes will be applied.
$ source ~/.bashrc
The above command is a shell instruction, that tells shell to reload the bashrc file. In this case, it will set all the variables and execute all the scripts mentioned in the file, without requiring you to logout and back in.
In this article, we have learnt how to reload bashrc file without logging out and back in. You can use this source command to reload configuration of other shells also.
How to Split File in Linux
Random Password Generator in Python
How to Generate Random Password in Linux
How to Use Wget to Download File Via Proxy
How to Get Hostname/Domain Name from IP Address