Difference between linux environment variables

Difference between login shell and non-login shell

login shell: A complete login process is required to obtain bash. That is to say, by entering the account number and password to log in to the system, the shell obtained at this time is called the login shell

 

non-login shell: The method to obtain the sbash interface does not require repeated login actions. For example, after logging in to linux with X Window, and then starting the terminal with the graphical interface of X, the terminal does not need to enter the account number and password, and the bash environment is the non-login shell. Execute the bash command again in the original bash environment, and enter the new bash environment (subprocess of the previous bash) without entering the account password. The new bash is also a non-login shell

 

 

/etc/profile global (public) configuration, no matter which user is, this file will be read when logging in

 

/etc/bashrc corresponds to /etc/bash.bashrc, which is also global. When bash is executed, no matter what the method is, it will read this file

 

~/.profile If bash is executed in login mode, read ~/.bash_profile, if it does not exist, read ~/.bash_login, if the first two do not exist, read ~/.profile; mode login, this file will be read even if ~/.bash_profile and ~/.bash_login exist

 

~/.bash_login If bash is executed in login mode, read ~/.bash_profile, if it does not exist, read ~/.bash_login, if neither of the first two exist, read ~/.profile

 

~/.bash_profile This file is only read when bash is executed as login. Usually the configuration file is also configured to read ~/.bashrc

 

~/.bashrc Read this file when bash is executed as non-login. If executed in login form, this file will not be read

 

~/.bash_logout This file will only be read when logged out and in the form of login. That is, this file will be read when you log out in text mode, and will not be read when you log out in graphics mode

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326142755&siteId=291194637