Ubuntu environment variable parsing, ubuntu environment variable
The following files can be used to set environment variables in Ubuntu:
/Etc/profile:At login,The first file used when the operating system customizes the user environment,This file sets environment information for each user of the system,When a user logs on for the first time,The file is executed.
/Etc/environment:The second file used by the operating system at login,The system is reading your own profileBefore,Set the environment variable of the Environment File
~ /. Profile:The third file used for logon is. profile.File,Each user can use this file to input a dedicated shell.Information,When a user logs on,This file is only executed once!By default,It sets some environment variables,Execute the user's. bashrcFile.
/Etc/bashrc:Run bash shell for eachThe user executes this file.When bash shellWhen opened,The file is read.
~ /. Bashrc:This file contains your bash shellBashInformation,When logging on and opening a new shell,This file is read.
When you log on to and log on to shell as bash, bash first executes the command in the/etc/profile file (if the file exists), and then searches
~ /. Bash_profile ,~ /. Bash_login or ~ /. Profile file, and execute the command in the first readable file found. When you log on to bash and exit, it will execute ~ /. Bash_logout file.
When an interactive bash is started, it will execute ~ /. Commands in the bashrc file (if the file exists and is readable). When a shell script is started non-interactively, bash searches for the bash_env environment variable and determines the name of the execution file.
I am the dividing line of tiantiao