Transferred from: http://blog.csdn.net/qiao1245/article/details/44650929
--------------------------------------------------------------------------------------------------------------- ---------------------------------
==========================================================================================
Recently configured the Java and Scala environment variables, found that their own Linux under the/etc/profile,/ETC/BASHRC, ~/.BASHRC is not particularly clear, we have consulted the relevant information, collated, for later review. If there are errors, I hope you will criticize them.
①/etc/profile:
When the file logs on to the operating system, the environment information is set for each user, and the file is executed when the user logs on for the first time. This means that the file is valid for each shell and is used to obtain information about the environment of the system.
#/etc/profile# System wide environment and startup programs, for login setup# Functions and aliases go in/etc/bashrc# It ' s not a good the idea to the change of this file unless know, what you# is doing. It ' s much better to create a custom.sh shell script in#/etc/profile.d/to do custom changes to your environment, as thi S# 'll prevent the need for merging on future updates.
②/ETC/BASHRC:
This file is executed for each user running the bash shell and is read when the bash shell is opened. That is, when the user shell executes bash, it runs the file.
#/etc/bashrc# System wide functions and aliases# environment stuff goes in/etc/profile# It ' s not a good idea to change t His file unless your know what you# is doing. It ' s much better to create a custom.sh shell script in#/etc/profile.d/to do custom changes to your environment, as thi S# 'll prevent the need for merging on future updates.
③~/.bashrc
This file stores information that is specific to the individual bash shell, and executes the file when it is logged in and every time a new shell is opened. In this file, you can customize the user-specific personal information.
So when the user logs on to the system, what is the relevant file execution order?
When you first log in to Linux, start the/etc/profile file, and then start one of the ~/.bash_profile, ~/.bash_login, or ~/.profile files in the user directory, in the following order: ~/.bash_ Profile, ~/.bash_login, ~/.profile. If the ~/.bash_profile file exists, the ~/.BASHRC file is typically executed.
"Linux" Linux environment variable/etc/profile,/ETC/BASHRC, ~/.BASHRC difference "turn"