The difference and connection between profile, BASHRC and Bash_profile in Linux_linux (RPM)

Source: Internet
Author: User
Tags aliases

/etc/profile: This file sets the environment information for each user of the system, and the file is executed when the user logs on for the first time.

and collect the shell settings from the configuration file of the/ETC/PROFILE.D directory.

The English description is:

#/etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases Go IN/ETC/BASHRC

# It's not a good idea to the change this file unless you know
# is doing. It ' s much better to create a custom.sh shell script in
#/etc/profile.d/to make custom changes to your environment, as this
# would prevent the need for merging on future updates.

So if you have a change to/etc/profile, you have to restart your changes to take effect, and this change will take effect for each user.

/ETC/BASHRC: Executes this file for each user running the bash shell. When the bash shell is opened, the file is read.

The English description is:

#/ETC/BASHRC

# System wide functions and aliases
# Environment Stuff Goes In/etc/profile

# It's not a good idea to the change this file unless you know
# is doing. It ' s much better to create a custom.sh shell script in
#/etc/profile.d/to make custom changes to your environment, as this
# would prevent the need for merging on future updates.

If you want to modify a configuration for all users who use bash and then open it later, you can modify the file, modify the file without restarting, and reopen a bash to take effect.

~/.bash_profile: Each user can use this file to enter shell information dedicated to their own use, when the user logs on, the file is only executed once! By default, he sets some environment variables to execute the user's . BASHRC File .

This file is similar to/etc/profile and requires a reboot to take effect,/etc/profile for all users, ~/.bash_profile only for the current user.

~/.BASHRC: This file contains bash information dedicated to your bash shell, which is read when you log in and every time you open a new shell. (Each user has a. bashrc file in the user directory)

This file is similar to/ETC/BASHRC, does not require a restart to take effect, reopen a bash to take effect,/ETC/BASHRC for all users of the new bash will take effect, but ~/. BASHRC only for the current user's newly opened bash.

~/.bash_logout: Executes the file each time it exits the system (exiting the bash shell).

In addition, variables set in/etc/profile (global) can be applied to any user, whereas variables set in ~/. BASHRC (local) can only inherit variables from/etc/profile, and they are "parent-child" relationships.

~/.bash_profile is interactive, login way into bash run;


~/.BASHRC is an interactive non-login way to go into bash running;


Usually the two settings are roughly the same, so the former usually calls the latter.

The difference and connection between profile, BASHRC and Bash_profile in Linux_linux (RPM)

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.