shell,

How to reload shell session

Nov 19, 2021 · 1 min read · Post a comment

In order to update and see changes made in the shell environment, most of the time 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 Terminal and run the following command:

source ~/.bashrc

or, alternatively

. ~/.bashrc

Note(s): 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 instance:

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.