/etc/profile,/ETC/BASHRC, ~/.bash_profile, ~/.BASHRC differences

Source: Internet
Author: User


/etc/profile,/ETC/BASHRC, ~/.bash_profile, ~/.BASHRC are easily confused, what is the difference between them? What is their role in the end?


/etc/profile: Used to set system environment parameters, such as $path. The environment variables are in effect for all users in the system.

/ETC/BASHRC: This file sets the System bash shell-related stuff into effect for all users in the system. As long as the user runs the Bash command, the inside thing is working.

~/.bash_profile: Used to set some environment variables, functions and/etc/profile similar, but this is set for the user, that is to say,

You set the environment variable in the/home/user1/.bash_profile, then this environment variable is only valid for User1 this user.

~/.BASHRC: Acts similar to/ETC/BASHRC, but only for the user itself, not for other users.


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


~/.bash_profile is interactive and login to bash, meaning it only takes effect if the user logs on.

~/.BASHRC is an interactive non-login way into bash, and the user is not necessarily logged in, as long as the command line is run as that user and the file is read.


/etc/profile,/ETC/BASHRC, ~/.bash_profile, ~/.BASHRC differences

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.