Brief summary of several configuration files called During shell login

Source: Internet
Author: User
A brief summary of several configuration files called when logging on to start shell recently took over a server. after logging on with root, I felt that the bashshell environment was particularly uncomfortable. I just wanted to change it, they are all written in the/etc/profile file. So I summarized it and started 1... A brief summary of several configuration files called when logging on to start shell recently took over a server. after logging on to the server as root, I felt that the bash shell environment I set was particularly uncomfortable. I just wanted to change it. The result showed that, they are all written in the/etc/profile file. So I will summarize what files will be called when a bash is started. if you want to configure your own bash environment, What files should be modified and What files should not be modified. When a user enters the account password to log on to a user terminal, the system first reads the/etc/profile file and loads the configuration, the/etc/profile file will call several more files, including the/etc/sysconfig/i18n file, to set the language information of the terminal, the/etc/inputrc file mainly sets the terminal input mode, such as Ctrl + C, and the more important one is/etc/profile. d/directory, if you really need to modify some global bash environments, it is best to write the environment as a shell script and put it in/etc/profile. in the d/directory,/etc/profile will be automatically called upon logon. As mentioned above, the global file executed during user login will be executed under the home directory of the user, mainly including. bash_profile ,. bash_login ,. profile files. Generally, your home directory should only have. bash_profile file, because the system only executes one of the three files, if not found. bash_profile to continue searching. bash_login. if not, search. profile. Open. bash_profile in the vim editor. you can see that this file will be called again ~ /. Bashrc file, you can see some alias settings, so if you need to set your own personal alias and some environment variables, it is strongly recommended to write them in this file or ~ /. Bash_profile. But it is written in ~ /. Bashrc is better. why? For example, if you directly open a command line terminal in X window, you do not need to enter the account and password to log on. in this case, in fact, it will not read/etc/profile ,~ The/. bash_profile file directly reads the./bashrc file. Therefore, if you want your environment settings to be effective at any time, it is recommended to write the file. Let's try again later ~ /. The contents in the bashrc file can be seen that this file will actually call the content of the/etc/bashrc file and use vim to open the/etc/bashrc file, it will be found that the/etc/profile will be called at the end of the file. d/The sh file in it. haha, it's interesting ~~~ In fact, many of Linux are like this. In the end, they all share the same path and are included in a file.
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.