登录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这个文件

评论