美文网首页
profile .bash_profile .bashrc的区别

profile .bash_profile .bashrc的区别

作者: 柔软的胖 | 来源:发表于2017-04-28 12:14 被阅读0次

    用户以bash登录时,会执行一系列启动脚本。

    /etc/profile -> ~/.bash_profile -> ~/.bash_login -> ~/.profile

    用户退出bash时,会执行清理脚本。

    ~/.bash_logout

    用户使用非bash登录时,然后切换到bash,会执行配置脚本。比如,登录时时sh,然后切换到bash。

    ~/.bashrc

    不同启动脚本具有不同的应用范围。

    • /etc/profile - 系统启动脚本。所有用户登录时,都会执行。
    • ~/.bash_profile - 用户启动脚本。用户登录时,执行自己目录下的启动脚本。
    • ~/.bashrc - 用户配置脚本。当从非bash切换到bash时,执行用户目录下的配置脚本。
    • ~/.bash_logout - 用户清理脚本。当登录用户退出时,执行用户目录下的清理脚本。

    详情参考man bash

    相关文章

      网友评论

          本文标题:profile .bash_profile .bashrc的区别

          本文链接:https://www.haomeiwen.com/subject/vzbozttx.html