1.5 Common configuration files in Ubuntu
1)/etc/profile
2/etc/environment environment variable defined in this file, you can view the contents of the file with Vim/etc/environment
3) ~/.profile
4) ~/.BASHRC
5 ~/.bash_profile This file, checked the relevant, but the system does not have this file;
Description:/etc/profile and/etc/environment files are global in nature, work for all users, and ~/.profile three files that work for the current user;
Note:~ Represents the home directory of the current user, the home directory of the root is/root/, and the normal user's home directory is typically a hidden file/home/the user name/;.BASHRC (with a dot in front of the filename);
2. The difference between normal user and root user login
1 when the root user logs in, the order in which these files are executed is:/etc/profile, the other files will not be loaded (executed);
2 Ordinary users log in, the order to execute the above files is:/ETC/PROFILE,~/.PROFILE,~/.BASHRC, the other two files will not be loaded (execution);
3 It is important to understand the order in which files are executed, so that you can know which file to set the environment variable and can load the environment variable at login;
4 The function of the/etc/environment file is to load the environment variable from the file when the system uses the environment variable, but do not add anything to the file;
3. How to configure environment variables
1 if it is used by all users, configure the environment variable in the/etc/profile file, and configure it in the ~/.profile file if it is used by the user.
2 After the configuration is complete, you need to log on again or execute the following command: Source/etc/profile
4. Some questions about environment variables
1 Why the environment variable is very short in/etc/environment, but when the output command echo $PATH found the environment variable increased a lot.
A: Because the system has loaded your configuration file with commands about importing the environment.
2 in the configuration file, only the value of the imported environment variable is modified, but the path that was added before the output command echo $PATH is still present.
Answer: Because the system does not reload the environment variable, this time only need to reload the file/etc/environment can, source/etc/environment;