Redhat Linux/etc/profile and/etc/bashrc, redhatbashrc

Source: Internet
Author: User

Redhat Linux/etc/profile and/etc/bashrc, redhatbashrc

I recently learned about RHCE. Here in umask, the two files/etc/profile and/etc/bashrc are to be modified, but they do not indicate the differences. So after checking on the internet, I realized how to use them. /Etc/profile corresponds to logon, and/etc/bashrc corresponds to opening shell. But what is the difference in actual use? If bashrc is corresponding to shell, then this file cannot be changed? At last, I tried it myself and found that it was still different. I would like to share it with you and make a record.

Tutorial preparation: Change umask in the/etc/profile file to 007, and change umask in/etc/bashrc to 077.

Tutorial steps:

1. Log On As root and open shell. umask value: 022

2. su test, umask value 077

3. su-test, umask value 007

Experiment results: If you only switch the user and do not log on again, the profile script will not be executed, so that the script in bashrc works.

 

Therefore, if you do not want to solve the problem of ambiguity, you can honestly change the two files. Because there is no time to write the program, but if there is no guess, the program should use the value in bashrc.


What is the difference between the profile and/etc/bashrc in linux etc?

/Etc/profile: This file sets the environment information for each user in the system. When the user logs on for the first time, this file is executed and starts from/etc/profile. d. Collect shell settings in the configuration file of the directory,
/Etc/bashrc: execute this file for every user running bash shell. When bash shell is opened, the file is read.
~ /. Bash_profile: each user can use this file to input the shell information dedicated to their own use. When a user logs on, this file is only executed once! By default, it sets some environment variables to execute the user's. bashrc file.
~ /. Bashrc: This file contains bash information dedicated to your bash shell. This file is read when you log on and every time you open a new shell.

/Bashrc and/etc/profile in linux

Does your. bash_profile have these?

# Source the system wide bashrc if it exists
If [-e/etc/bash. bashrc]; then
Source/etc/bash. bashrc
Fi

# Source the users bashrc if it exists
If [-e "$ {HOME}/. bashrc"]; then
Source "$ {HOME}/. bashrc"
Fi

OK if you haven't joined.

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.