.bashrc and .bash_profile

James Olin Oden james.oden at gmail.com
Fri Nov 2 18:18:04 UTC 2007


On 11/2/07, Zhou, Jingchen <jingchen at slac.stanford.edu> wrote:
> I am new to bash. It looks like there are two initialization files .bashrc and
> .bash_profile in $HOME which are generated when creating new accounts on
> Linux.

I'll try to answer, but if I'm wrong someone please correct me.

> Why there are two? What is each one for?
.bash_profile is meant for login shells and interactive sessions.
.bashrc is used for
non-interactive sessions.  They effectively both get sourced in, but
you never want
to put stuff in .bashrc that would cause stuff to be displayed, or
worse ask for
user input.

> Can I make them as one, e.g. moving things from  .bash_profile to .bashrc, and
> only use .bashrc?
Yes provided you take into account what I said above.

>
> Thanks,
Your welcome...james




More information about the redhat-sysadmin-list mailing list