[Gllug] .bash_profile & .bashrc

Doug Winter doug at pigeonhold.com
Mon Aug 30 10:05:28 UTC 2004


Andrew Black (li) wrote:
> I am confused between the files - .bash_profile & .bashrc
> I am trying to put some customised alias and $PATH etc and am finding things
> are different between a Konsole session and an SSH session.
> 
> What is the rationale for putting things into either file.

The bash manual says (i've elided some bits):

INVOCATION
        A  login  shell is one whose first character of argument
        zero is a -, or one started with the --login option.

        When bash is invoked as an interactive login  shell,  or
        as  a  non-interactive shell with the --login option, it
        first  reads  and  executes  commands  from   the   file
        /etc/profile,  if  that file exists.  After reading that
        file, it looks for ~/.bash_profile,  ~/.bash_login,  and
        ~/.profile,  in  that order, and reads and executes com-
        mands from the first one that exists  and  is  readable.

        When  an  interactive shell that is not a login shell is
        started,  bash  reads   and   executes   commands   from
        /etc/bash.bashrc  and  ~/.bashrc,  if these files exist.

The login program runs your shell as a login shell, so when you first 
log into your system .profile is read - otherwise it would not normally 
be read.  Your terminal program may have an option to run the shell as a 
login shell.

doug.


-- 
6973E2CF: 2C95 66AD 1596 37D2 41FC 609F 76C0 A4EC 6973 E2CF
http://adju.st/
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list