Ubuntu environment variable parsing, ubuntu environment variable

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.