Bash Profile vs Bashrc - DevDummy

Latest

Coding Hacks, Shared ...

Thursday, November 17, 2016

Bash Profile vs Bashrc





The simple rule of thumb here is,

".bash_profile is executed for login shells,
.bashrc is executed for non-login shells"



Login Shells
As the name says, when you use a login, a username & password through a console, it is a login shell. This also applicable if you are login remotely via SSH. So if you need to see the things happening only in login shell, just add the settings only to the .bash_profile.

Non-Login Shells
After a login, you may need to open a new terminal and that is a non-login shell as it is just a terminal that you want to work on.Adding  the settings to .bashrc would do the thing when get a non-login shell.

No comments:

Post a Comment