当一个用户登录linux系统时,Login shell按如下顺序执行报需的脚本。

一、执行/etc/profile这个启动脚本(startup script),在/etc/profile这个startup script中会调用/etc/profile.d目录下的所有startup scripts。


二、执行~/.bash_profile(用记家目录中的.bash_profile)这个startup script,在~/.bash_profile这个startup script中又会调用用户家目录中的.bashrc 这个startup script ,而~/.bashrc又将调用/etc/bashrc。


通常情况下,每一个新建的linux用户都会自动建立.bashrc、.bash_profile放在自己的家目录中。