Linux reads profile and BASHRC files

Source: Internet
Author: User

The recent study of Linux, the Linux profile and BASHRC files are not clear, so in-depth study.

If you want to know when these files are being executed, you need to know a few tips about the shell. (CentOS6.5 Linux)

1.login Shell, login shell, init 3 boot Linux, you need to enter the user name and password, enter the shell is Loginshell.

Note : Using su-user_name to switch users in the shell, the login shell is also the login shell

The files that the login shell reads are:/etc/profile, $HOME/.bash_profile, $HOME/.bash_login, $HOME/.profile, read in the order above.

2. There is login shell with no login shell.

No login shell has, enter bash in the login shell, do not enter the user name and password, then this is the no login shell.

Under the graphical interface, open a shell and no login shell

No login shell is open, the file executed is $HOME/.BASHRC, and. BASHRC executes the/ETC/BASHRC file (the. bashrc file of the home directory can be viewed).

Here is a simple flowchart:

Example: 1. In a non-graphical interface, if you want to configure PS1 this environment variable, it is best to configure to/etc/profile or $home/.bash_profile, so log out in the login, will execute this command

2. If the user is a graphical interface, configure PS1, need to configure the $HOME/.BASHRC file, or/ETC/BASHRC file, because when you open no login shell, read

$HOME/.BASHRC ( This file will read/ETC/BASHRC) this file.

Linux reads profile and BASHRC files

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.