/etc/profile: 此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行。
/etc/bash.bashrc :为每一个运行bash shell的用户执行此文件,当bash shell被打开时,该文件被读取
可以看出 在/etc 文件夹下的配置文件是作用于所有用户的。
在用户文件夹下 (/home/$USER/):
~/.profile: 每个用户使用该文件输入专用于自己使用的shell信息, 当用户登录时,该文件仅仅执行一次,默认情况下,它设置一些环境变量,执行用户的.bashrc文件。
~/.bashrc: 该文件包含专用于用户的bash shell的bash信息,当登录时以及每次打开新的shell时,该文件被读取。
~/.bash_logout: 当每次退出系统(退出bash shell)时,执行该文件。
changes made to a profile
file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as source $HOME/.profile or source /etc/profile
.