The recent study of Linux, the Linux profile and BASHRC files are not clear, so in-depth study.
If you want to know when these files are being executed, you need to know a few tips about the shell. (CentOS6.5 Linux)
1.login Shell, login shell, init 3 boot Linux, you need to enter the user name and password, enter the shell is Loginshell.
Note : Using su-user_name to switch users in the shell, the login shell is also the login shell
The files that the login shell reads are:/etc/profile, $HOME/.bash_profile, $HOME/.bash_login, $HOME/.profile, read in the order above.
2. There is login shell with no login shell.
No login shell has, enter bash in the login shell, do not enter the user name and password, then this is the no login shell.
Under the graphical interface, open a shell and no login shell
No login shell is open, the file executed is $HOME/.BASHRC, and. BASHRC executes the/ETC/BASHRC file (the. bashrc file of the home directory can be viewed).
Here is a simple flowchart:
Example: 1. In a non-graphical interface, if you want to configure PS1 this environment variable, it is best to configure to/etc/profile or $home/.bash_profile, so log out in the login, will execute this command
2. If the user is a graphical interface, configure PS1, need to configure the $HOME/.BASHRC file, or/ETC/BASHRC file, because when you open no login shell, read
$HOME/.BASHRC ( This file will read/ETC/BASHRC) this file.
Linux reads profile and BASHRC files