Differences between logon shell and non-Logon Shell

Source: Internet
Author: User

By using the startup script, you can make the custom environment ready for use once and for all.
These scripts run when the shell is created.
The startup scripts run vary depending on whether the shell is used to log on to the shell or not.
We use "Su-" to log on to shell; "Su" to log on to non-shell.
Typical examples in the startup script include:
① Local variable settings, especially PS1
For example, my:

[oracle@10gR2 ~ $]tail -f .bash_profile | grep -n --color=auto 'PS1'10:export PS1='[\u@10gR2 \W \$]'

② Environment variables such as path
③ Alias
④ Umask

(I) log on to Shell

/Etc/profile is the first startup script to run after the shell is started.
It only runs for the login shell; non-login shell will not trigger this script
Log on to the shell to load the startup script in the following sequence:
/Etc/profile →/etc/profile. D →. bash_profile →. bashrc →/etc/bashrc
Each called script will sequentially cancel the changes in the previous call script.
When logging out of shell, we can also execute some tasks, such as creating automatic backup and clearing temporary files.
Place these tasks in the. bash_logout file.

(Ii) Non-Logon Shell

The sequence of loading startup scripts for non-login shell:
. Bashrc →/etc/profile. d

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.