Linux environment variable setting file and linux environment variable setting
In Linux, environment variables include system-level and user-level. System-level environment variables are system variables that every user logging on to the system must read, user-level environment variables are the environment variables loaded by the user using the system. Therefore, files that manage environment variables are divided into system-level and user-level files.
System Level:
/Etc/profile this file sets the environment information for each user in the system. When the user logs on for the first time, this file is executed. And collect shell settings from the configuration file in the/etc/profile. d directory. Therefore, if you modify/etc/porfile, the modification takes effect only after the machine is restarted. This modification takes effect for every user. /etc/bashrc this file is executed by every user running bash shell. When the bash shell is opened, the file is read. If you want to modify a configuration for all bash users and the bash will take effect in the future, you can modify this file without restarting, re-open a bash or execute the source/etc/bashrc command.
User level:
~ /Bash_profile each user can use this file to input the shell information dedicated to the current user. When the user logs on, this file is executed only once. By default, it sets some environment variables to execute the user's. bashrc file. This file is similar to/etc/porfile. It takes effect only after being restarted./etc/porfile takes effect for all users ,~ /. Bash_profile only applies to the current user .~ /. Bashrc the file contains bash information for the current user's bash shell. The file is read at login and every time a new shell is opened. This file is similar to/etc/bashrc and does not need to be restarted to take effect. re-open a bash file or execute source ~ /. Bashrc will take effect, and/etc/bashrc will take effect for all newly opened bash by users, ~ /. Bashrc takes effect only for the newly opened bash of the current user.