The difference and connection between profile, BASHRC, Bash_profile in Linux

Source: Internet
Author: User

/etc/profile: This file sets the environment information for each user of the system, and the file is executed the first time the user logs on. and collects the shell settings from the configuration file of the/ETC/PROFILE.D directory .  English Description:  #/etc/ profile # System wide environment and startup programs, for login setup# Functions and aliases go in/etc/bashrc&nbsp ; # It's not a good the idea to the change of this file unless know, what you# is doing. It ' s much better to create a custom.sh shell script in#/etc/profile.d/to do custom changes to your environment, as thi S# will prevent the need for merging in future updates.  so if you have a change to/etc/profile, you have to restart your changes to take effect, and this change takes 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 .  English description:  #/etc/bashrc # System Wide Functions and aliases# environment stuff goes in/etc/profile # It's not a good idea to change this file unless you K Now what you# is doing. It ' s much better to create a custom.sh shell script in#/etc/profile.d/to do custom changes to your environment, as thi S# 'll prevent the need for merging on future updates.  if you want to use bash for allIf the user modifies a configuration and the bash that is opened later takes effect, 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, also requires a restart 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, no restart is required, reopening a bash will take effect, /ETC/BASHRC is effective for all user-opened bash, 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, while variables set in ~/.BASHRC and so on (local) can only inherit variables in/etc/profile, they are "parent-child" relationships.  ~/.bash_ Profile is interactive, login way into bash run, ~/.BASHRC is interactive non-login way into bash, usually the two settings are roughly the same, so the former will usually call the latter.

From for notes (Wiz)

The difference and connection between profile, BASHRC, Bash_profile in Linux

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.