/etc/profile resolution

Source: Internet
Author: User
Tags locale

The files associated with environment variables may also have/ETC/BASHRC, but this is a shell variable, which is local, and is useful for a particular shell. /etc/profile is global and applies to all shells.

The profile will tell the shell what language to use, what shell, the search path for the command, and so on.

Some of the standard environment variables:

Shell default Shell

LANG Default language

Path Linux looks for the default path for commands, typically including/bin,/usr/bin,/sbin,/usr/sbin,

/usr/x11r6/bin,/opt/bin,/usr/local/bin and so on. Users can add their own,

such as/home/bin and so on.

The default path to the Manpath man manual

INPUTRC default keyboard image, see/ETC/INPUTRC

BASH_ENV bash shell environment variables, usually in ~/.BASHRC

The DISPLAY X window is applicable to the console, display=:0 corresponds to the console f7,display=:1 corresponding to the control

F8,display=server:0 sends GUI applications to remote computers.

The default terminal in the Colorterm GUI, usually the gnome-terminal.

User automatically sets the username of the user who is currently logged on.

LongName is usually set to $user

Mail sets the standard mail directory for specific $USR

HOSTNAME the command output set to/bin/hostname

Histsize the number of commands that are set to remember for the history command

Example:

#

#/etc/profile

#

#修改或添加PATH可以自定义命令的寻找路径, if you don't want to add an executable file to the default directory but you can use it in the terminal

#令, then change it.

Export path= "/bin:/usr/bin:/sbin:/usr/sbin:/usr/x11r6/bin:/opt/bin:/usr/local/bin"

Export manpath= "/usr/man:/usr/x11r6/man"

Export lesscharset= "Latin1"

Export inputrc= "/ETC/INPUTRC"

Export less= "-R"

# Locale settings (Find your Locale with ' locale-a ')

Export lang= "ZH_CN" #修改这里可以改变系统的默认使用语言

Export lc_collate= "C"

Export COLUMNS LINES

Export ps1= ' [/u@/h/w]/$ ']

Export ps2= ' > '

Umask 022

......

......

# End of File

The process of executing several files, such as/etc/profile, ~/.bash_profile, etc. when you log on to Linux

Article summary: Regarding the login Linux,/etc/profile, ~/.bash_profile and so on several files execution process. The process of executing a file when you log on to Linux is as follows: When you just log on to Linux, start the/etc/profile file first, and then start one of the ~/.bash_profile, ~/.bash_login, or ~/.profile files in the user directory. The order of execution is: ~/.bash_profile, ~/.bash_login, ~/.profile. If the ~/.bash_profile file exists, it will usually execute ~

On the login Linux,/etc/profile, ~/.bash_profile, and several other files of the implementation process.

The process of executing files when you log on to Linux is as follows:

When you just log on to Linux, start the/etc/profile file first, 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 usually executed. Because the following code is generally available in the ~/.bash_profile file:

If [f ~/.BASHRC]; Then

. ./BASHRC

Fi

In ~/.BASHRC, the following code is generally available:

if [-F/ETC/BASHRC]; Then

. /bashrc

Fi

Therefore, ~/.BASHRC will invoke the/ETC/BASHRC file. Finally, when you exit the shell, the ~/.bash_logout file is also executed.

The order of execution is:/etc/profile-> (~/.bash_profile | ~/.bash_login | ~/.profile)-> ~/.BASHRC->/ETC/BASHRC-> Gout

For the scope of each file, the following instructions were found on the Web:

(1)/etc/profile: This file sets the environment information for each user of the system, and the file is executed when the user logs on for the first time. and collects the shell's settings from the/ETC/PROFILE.D directory's configuration file.

(2)/ETC/BASHRC: This file is executed for each user running the bash shell. When the bash shell is opened, the file is read.

(3) ~/.bash_profile: Each user can use this file to enter the shell information dedicated to their own use, when the user logs on, the file is only executed once! By default, he sets some environment variables to execute the user's. bashrc file.

(4) ~/.BASHRC: This file contains bash information dedicated to your bash shell, which is read when you log in and each time you open a new shell.

(5) ~/.bash_logout: Executes the file every time you exit the system (the Bash shell is exited). In addition, the variables set in the/etc/profile (global) can be applied to any user, while the variables set in ~/.BASHRC, such as local, can only inherit the variables in/etc/profile, they are "parent-child" relationships.

(6) ~/.bash_profile is the interactive, login way to enter bash run ~/.BASHRC is the interactive non-login way into bash usually the two settings are basically the same, so usually the former will call the latter.

Source Documents

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.