Environment variables in Linux include system-level and user-level, system-level environment variables are system variables to be read by every user logged into the system, and user-level environment variables are the environment variables that are loaded when the user uses the system.
Therefore, the management environment variable files are also divided into system-level and user-level, the following posted on the Internet to find a more clear description of the document (slightly modified) [1]:
System level:
/etc/profile: This file is the first file that is used by the operating system to customize the user environment when the user logs on, and applies to every user who logs on to the system. This file is typically called the/ETC/BASH.BASHRC file.
/ETC/BASH.BASHRC: System-level BASHRC file.
/etc/environment: The second file used by the operating system at logon, the system sets environment variables for environment files before reading your own profile.
User level (these files are in the home directory):
~/.profile: Each user can use this file to enter shell information dedicated to their own use, when the user logs on, the file is only executed once! By default, he sets some environment variables to execute the user's. bashrc file. This is where personal settings are recommended.
~/.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. It is not recommended to put it here, because every time you open a shell, the file will be read once and the efficiency must be affected.
~/.bash_profile or ~./bash_login: There is no reference to the author here, the following will mention
~/.pam_environment: User-level environment variable settings file, did not do the test, do not know whether the tube is used.
Environment variables in the shell