How do I find which .bashrc
file is loaded when shell is started?
Are there any command that can tell me that?
Currently I think it is /root/.bashrc
it is a Ubuntu server 10.04 LTS.
Is it userbased or?
Simply use echo. Put an expression into bashrc
echo "I am in $PWD/$0" or "I am in bashrc file".
With that you will see when logging on a printed message which will confirm you that process uses specific script file. Note - it is not wise to e.g. start a program from bashrc or bash_profile, because if program for some reason won't start or will have trouble to start, you won't be get into a shell.
The command you seek is man bash
, which tells you:
When bash is invoked as an interactive login shell, or as a non-inter-
active shell with the --login option, it first reads and executes com-
mands 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 commands from the first one that
exists and is readable. The --noprofile option may be used when the
shell is started to inhibit this behavior.
and
When an interactive shell that is not a login shell is started, bash
reads and executes commands from ~/.bashrc, if that file exists. This
may be inhibited by using the --norc option. The --rcfile file option
will force bash to read and execute commands from file instead of
~/.bashrc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With