linux shell对应的配置文件是怎么被执行的呢?-----聊聊/etc/profile, ~/.bash_profile, ~/.bashrc等配置文件的执行流程
来源:互联网 发布:昆明行知中学 编辑:程序博客网 时间:2024/06/08 08:58
本文来聊聊linux中的/etc/profile, ~/.bash_profile, ~/.bashrc等配置文件。首先, 我们来说一下login shell和non-login shell的概念:
login shell : 需要密码来登录的, 则为login shell, 比如你每次用SecureCRT来登录的shell。 要说明的是, SecureCRT可以存放密码, 所以即使你省略了输入这个输入密码的过程, 那还是login shell. 或者你在SecureCRT中clone一个session, 那也属于login shell, 因为间接用到了密码来登录(存储了)。
non-login shell: 不需要密码登录的shell, 比如你已经在一个shell当中, 执行bash命令(不需要密码)后, 进入到另外一个shell(子shell)中, 此时的shell就是non-login shell.
本文只讨论常见的login shell. 对于/etc/profile来说, 通常需要root权限才能修改它, 修改后, 其他任意用户再打开shell的时, 都会生效。 所以,改/etc/profile的时候必须仔细斟酌, 小心为妙, 因为会影响到该机器上的所有用户。
那每个用户可不可以有自己的个性化配置文件呢? 可以的! 比如我经常在~/.bashrc中增加和修改东西, 这个修改只影响我自己(~/.bash_profile也同理)。
对于 /etc/profile, ~/.bash_profile, ~/.bashrc等, 在我们登录login shell的时候, 都会被自动执行, 爽哈。
那还有其他的一些配置文件啊, 究竟是怎样的关系呢? 我们给出一幅图, 如下:
/etc/profile-------------------->~/.bash_profile---------------->bash操作
| |
| |
|- - ->/etc/inputrc |- - ->~/.bashrc
| |
| |
|- - ->/etc/profile.d/*.sh <- - - - - - /etc/bashrc
|
|
/etc/sysconfig/i18n
如上, 红线是主线, 虚线是“被调用”线。 大多数情况下, 只需要对这个图有大致的了解并用熟/etc/profile, ~/.bash_profile, ~/.bashrc即可。
OK, 就这样。
- linux shell对应的配置文件是怎么被执行的呢?-----聊聊/etc/profile, ~/.bash_profile, ~/.bashrc等配置文件的执行流程
- 关于shell启动时调用的几个配置文件/etc/profile .profile .bash_profile .bashrc等
- Linux 中/etc/profile、~/.bash_profile 等几个环境配置文件的执行过程
- linux下系统启动时,几个配置文件 /etc/profile、~/.bash_profile 等几个文件的执行过程,先后顺序
- linux下系统启动时,几个配置文件 /etc/profile、~/.bash_profile 等几个文件的执行过程,先后顺序
- Linux的配置文件/etc/profile和/bashrc
- 浅析linux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- Linux下/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc的区别
- linux下 /etc/profile、~/.bash_profile ~/.profile的执行过程
- linux下 /etc/profile、~/.bash_profile ~/.profile的执行过程
- linux下 /etc/profile、~/.bash_profile ~/.profile的执行过程
- linux下 /etc/profile、~/.bash_profile ~/.profile的执行过程
- linux下 /etc/profile、~/.bash_profile ~/.profile的执行过程
- linux下 /etc/profile、~/.bash_profile ~/.profile的执行过程
- linux下 /etc/profile、~/.bash_profile ~/.profile的执行过程
- /etc/profile、~/.bash_profile等几个文件的执行过程
- 【转】/etc/profile、~/.bash_profile等几个文件的执行过程
- /etc/profile、~/.bash_profile等几个文件的执行过程
- [kuangbin带你飞]专题二 搜索进阶 I - A计划(HDU 2102)
- 1020. Tree Traversals (25) (重建二叉树)
- SQL Server 访问发送Http请求
- 2015 naver's Reading List
- 常用嵌入式文件系统介绍
- linux shell对应的配置文件是怎么被执行的呢?-----聊聊/etc/profile, ~/.bash_profile, ~/.bashrc等配置文件的执行流程
- Android之集成友盟推送功能
- 字符串的处理
- material design
- 动态链接库DLL导出函数名字改编问题
- HDU ACM 1060 Leftmost Digit [数学题]
- Draw 9-patch(点9图)
- java 二分查找法
- DECLARE_MESSAGE_MAP()