Differences between linuxprofile and environment

Source: Internet
Author: User
The difference between linuxprofile and environment is to first add exportLANGzh_CN to/etc/profile, log out of the system and log on again. The logon prompt is in English. Delete exportLANGzh_CN in/etc/profile, add LNAGzh_CN to/etc/environment, and exit system heavy...
Differences between linux profile and environment: add export LANG = zh_CN to/etc/profile, log out of the system, and log on again. The logon prompt is in English. Delete export LANG = zh_CN in/etc/profile, add LNAG = zh_CN to/etc/environment, log out of the system and log on again. The logon prompt displays Chinese characters. When the user environment is established, the/etc/profile is always executed first and then the/etc/environment is read. Why is there a difference as described above? Run/etc/environment first and then/etc/profile. /Etc/environment is used to set the environment of the entire system, while/etc/profile is used to set the environment of all users. The former has nothing to do with the login user, and the latter has to do with the login user. The execution of the system application on www.2cto.com is irrelevant to the user environment, but it is related to the system environment. Therefore, when you log on, you will see the prompt information, the display format of date and time information is related to the LANG in the system environment. the default is LANG = en_US. if the system environment LANG = zh_CN, the message is displayed in Chinese, otherwise, it is in English.
For SHELL initialization, run/etc/profile first and then read the file/etc/environment. for the whole system, run/etc/environment first. Is this true? /Etc/enviroment -->/etc/profile --> $ HOME /. profile --> $ HOME /. env (if any) /etc/profile is the environment variable of all users./etc/enviroment is the system's environment variable. when logging on to the system, the shell should read in the order of www.2cto.com/etc/profile->/etc/enviroment --> $ HOME /. profile --> $ HOME /. env
The reason should be the difference between the user environment and the system environment mentioned by jtw. if the same variable is in the user environment (/etc/profile) and the system environment (/etc/environment) the value varies depending on the user environment. (1)/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 from/etc/profile. d Directory configuration file to collect shell settings. (2)/etc/bashrc: execute this file for every user running bash shell. When bash shell is opened, the file is read. Www.2cto.com (3 )~ /. Bash_profile: each user can use this file to input the shell Information dedicated to their own use. when a user logs on, this file is only executed once! By default, it sets some environment variables to execute the user's. bashrc file. (4 )~ /. Bashrc: This file contains bash information dedicated to your bash shell. This file is read when you log on and every time you open a new shell.
(5 )~ /. Bash_logout: execute this file every time you exit the system (exit bash shell). In addition, the variable (global) set in/etc/profile can act on any user, and ~ The variables (local) set in/. bashrc can only inherit the variables in/etc/profile. they are "parent-child" relationships. (6 )~ /. Bash_profile is interactive and login to run bash ~ /. Bashrc is the interactive non-login mode that enters bash. Generally, the two settings are roughly the same, so the former usually calls the latter.
 
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.