Chinaunix首页 | 论坛 | 博客
  • 博客访问: 394232
  • 博文数量: 105
  • 博客积分: 4100
  • 博客等级: 上校
  • 技术积分: 1040
  • 用 户 组: 普通用户
  • 注册时间: 2008-07-27 19:57
文章存档

2012年(1)

2011年(9)

2010年(4)

2009年(25)

2008年(66)

我的朋友

分类: LINUX

2008-07-28 09:30:49

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

阅读(608) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~