Linux中profile、bashrc、bash_profile之间的区别和联系

 配置文件 说明 执行时间 是否重启 有效范围
/etc/profile

为系统的每个用户设置环境信息,从/etc/profile.d目录

的配置文件中搜集shell的设置.

当用户第一次登录时 重启或者source操作(发现切换用户后要source下) 所有
/etc/bashrc 为系统中的每个用户打开bash shell时执行.  打开bash shell 不需要 所有
~/.bash_profile 默认情况下会调用~/.bash_rc 当用户第一次登录时 重启或者source操作 当前用户
~/.bash_rc 当打开新的shell时 打开bash shell 不需要 当前用户

参考文章:https://blog.csdn.net/chenchong08/article/details/7833242