- Turn from 9206151
- File Description:
- /ect/profile
- This file sets the environment information for each user of the system, and the file is executed the first time the user logs on. and collects the shell settings from the configuration file of the/ETC/PROFILE.D directory.
- /etc/bashrc
- Execute this file for each user running the bash shell. When the bash shell is opened, the file is read.
- ~/.bash_profile
- Each user can use the file to enter shell information dedicated to their own use, and when the user logs in, the file executes only once! By default, he sets some environment variables to execute the ~/.BASHRC file.
- ~/.bashrc
- The file contains bash information dedicated to the user's Bash shell, which is read when it is logged in and every time a new shell is opened.
- ~/.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 act on any user
- The variables set in ~/.BASHRC and so on (local) can only inherit the variables in/etc/profile, they are "parent-child" relationships.
- The order in which the configuration files are loaded after the user logs in:
- /etc/profile-------->/etc/profile.d/*.sh
- ~/.bash_profile-------->~/.BASHRC---------->/ETC/BASHRC
- Description
- Bash executes the/etc/profile script first, and the/etc/profile script executes the/etc/profile.d/*.sh in turn first
- Bash then executes the ~/.bash_profile script, the ~/.bash_profile script executes the ~/.BASHRC script, and the ~/.BASHRC script executes the/ETC/BASHRC script
- At this point, all environment variables and initialization settings have been loaded and completed.
- Bash then calls Terminfo and INPUTRC to complete the settings for Terminal properties and keyboard mappings, respectively.
The difference between Linux files ~/.BASHRC and ~/.bash_profile and/ETC/BASHRC and/etc/profile | Order of loading profiles after user logon