linux,

How to reload shell session

Nov 19, 2021 · 1 min read · Post a comment
How to reload shell session

In order to update and see changes made in the shell environment, most of the time a reload is required. So, instead of restarting the machine and wasting a lot of time, a simple command will reload the bash, zsh, ksh or whatever shell you are using.

Prerequisites

  • Shell environment

Solution

Open a terminal, and run the following command:

$ source ~/.bashrc

or, alternatively

$ . ~/.bashrc

Note: If .bashrc is missing, try with .bash_profile.

The same command applies to the other shell environments as well. If you are using zsh, which is a popular choice today, replace ~/.bashrc with ~/.zshrc. For example:

source ~/.zshrc

or, shorter

. ~/.zshrc

Conclusion

As always, hope this was practical and If you know any other ways to reload/restart a shell environment, please let me know. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on telegram.