/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