正文

bashrc与profile比较2008-07-03 20:59:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/yanyoushuai/36448.html

分享到:

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

阅读(1361) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册