After Linux login, the configuration execution order is (Debian serials capable):/etc/environment,/etc/profile, ~/.bash_profile | ~/.bash_login | ~/ ~/.bash_logout,/ETC/BASHRC, ~/.BASHRC,. Profile)
With regard to the role of individual files, the following instructions were found on Linuxsir:
(1)/etc/environment: This configuration file sets the basic path variable, and the system current language variables, although relatively short, but in the system startup occupies a pivotal role, such as the following is the contents of my system:
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
Language= "Zh_CN:zh:en_US:en"
Lang= "ZH_CN. UTF-8 "
(2)/etc/profile: This file sets the environment information for each user of the system, and the file is executed when the user logs on for the first time. and collect the shell settings from the configuration file of the/ETC/PROFILE.D directory.
(3)/ETC/BASH.BASHRC: Executes this file for each user running the bash shell. When the bash shell is opened, the file is read.
(4) ~/.bash_profile: Each user can use this file to enter the shell information dedicated to their own use, when the user log on, the file is only executed once! By default, he sets some environment variables to execute the user's. bashrc file.
(5) ~/.BASHRC: This file contains bash information dedicated to your bash shell, which is read when you log in and every time you open a new shell.
(6) ~/.bash_logout: Executes the file each time it exits the system (exiting the bash shell). In addition, the variables set in/etc/profile (global) can be applied to any user, while the variables set in ~/.BASHRC, etc. (local) only inherit variables from/etc/profile, they are "parent-child" relationships.
(7) ~/.bash_profile is the interactive, login way into bash run ~/.BASHRC is the interactive non-login way into bash normally the two settings are roughly the same, so the former usually calls the latter.
Original address: http://www.cnblogs.com/ifaithu/archive/2013/02/05/2893067.html