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 from/etc/The settings for the shell are collected in the configuration file of the PROFILE.D directory. English Description: #/etc/profile# System wide environment and startup programs, forlogin setup# Functions and aliases goinch/etc/bashrc# It's not a good the 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 forMerginginchFuture updates. So if you have the right/etc/if the profile is modified, you must restart your changes to take effect, and this modification 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. English Description: #/etc/bashrc# System wide functions and aliases# environment stuff goesinch/etc/profile# It's not a good the 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 forMerginginchfuture updates. If you want to modify a configuration for all users who use bash and then open it later, you can modify the file, change 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, and when the user logs in, 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 need to restart to take effect,/etc/profile for all users, ~/the. Bash_profile is only valid 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 for all users ' new bash, but ~/The . BASHRC is only valid for new bash that is currently opened by the current user. ~/. 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 from/etc/profile, they are"Father"relationships.~/. Bash_profile is interactive, login way into bash run;~/.BASHRC is an interactive non-the login method goes into bash, usually the two settings are roughly the same, so the former usually calls the latter. 

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

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.