bashrc与profile比较

bashrc与profile比较

      登录Linux的console操作环境后,会出现一个提示符号,在这个提示符号之后可以输入命令,Linux根据输入的命令会做回应,这一连串的动作是由一个所谓的 Shell 来做处理。

    Shell是一个程序,最常用的就是Bash,这也是登录系统默认会使用的Shell。

    profile与bashrc都是Shell的启动设置档,角色类似Microsoft DOS/Windows下的autoexec.bat文件,以下就是这二种文件自己个别的文字叙述。

    针对个别用户

    用户家目录/.bashrc

    # ~/.bashrc: executed by bash(1) for non-login shells.

    用户家目录/.profile

    # ~/.profile: executed by Bourne-compatible login shells.

    针对全体用户

    /etc/bash.bashrc

    # System-wide .bashrc file for interactive bash(1) shells.

    /etc/profile

    # /etc/profile: system-wide .profile file for the Bourne shell (sh(1))

    由以上叙述可以知道,差异在于:

    1.bashrc

    系统启动后就会自动运行。

    2.profile

    用户登录后才会运行。

    3.进行设置后,可运用source bashrc命令更新bashrc

    也可运用source profile命令更新profile

    通常我们修改bashrc,有些linux的发行版本不一定有profile这个文件

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值