LINUX : How to reload or change your current shell ?

Shell Tips
January 10, 2007 | COMMENTS

If you have change your rc file of your favorites bash (like ~/.bashrc in "bash"), you can reload it easly by using "exec". Just type the following command line :

nicolas@grimm:~/$ exec bash

Exec replace the current process image with a new process image . So, now if you add aliases in your ~/.bash_aliases, just use "exec bash" and you could use your aliases in your current terminal. This way is also useful if you want to change your current shell without spawn another process. I mean, if you have a box where your login shell is a classical "sh", you can also do an "exec bash", that will replace your current shell by a friendly one.

Update: You can also use exec $SHELL which would be compatible with all your shells, though be aware your active shell may not be the same.