bash的配置文件分为两类
全局配置 /etc/profile  /etc/profile.d/*.sh  /etc/bashrc
个人配置 ~/.bash_profile  ~/.bashrc


profile类的配置:设定环境变量;运行命令或脚本
bashrc类的配置:设定本地变量;定义命令别名

登录式shell如何读取配置文件

(通过本地命令行或远程终端登录;su - username)
/etc/profile --> /etc/profile.d/*.sh --> ~/.bash_profile --> ~/.bashrc --> /etc/bashrc

先加载全局配置,后加载个人配置,如有重复项目,后加载的部分将覆盖前面加载的部分

非登录式shell如何读取配置文件

(su username;图形界面下打开终端命令窗口;自动执行的shell脚本)
~/.bashrc --> /etc/bashrc --> /etc/profile.d/*.sh