Bash初始化文件/etc/profile .bash_pro-file .bash_login .profile .bash_logout /etc/bashrc .bashrc
2012-01-01 21:11
357 查看
当启动shell时,他将运行初始化文件初始化自己。具体运行哪个文件要看是登录shell还是交互式非登录shell还是非交互式shell(用来执行shell脚本)
登录shell
/etc/profile sehll首先执行/etc/profile中的命令。通过这个文件,root用户可以为全系统内的所有bash用户建立默认特性。
.bash_pro-file .bash_login和.profile然后一次查找~/.bash_pro-file~/.bash_login和~/.profile(~是用户主目录),并执行他找到的首个文件中的命令。这些设置将覆盖/etc/profile中的设置(可以想象成win的用户环境变量覆盖系统环境变量)
.bash_logout
当用户注销时,bash执行文件~/.bash_logout中的命令。他要执行一些清理任务。
交互式非登录shell
交互式非登录shell不执行前面的初始化文件。然而,继承了登录shell的初始化设置。
/etc/bashrc
尽管不是通过bash直接调用许多~/.bashrc文件还是调用了/etc/bashrc。这中安排使得root可以为全系统内的交互式非登陆bashshell建立默认特性。
.bashrc
交互式非登录shell执行~/.bashrc文件,而登录shelll的初始化文件通常会调用这个文件。这样,登录shell和交互式非登录shell都可以使用~/.bashrc文件。
非交互式shell
非交互式非shell不执行前面的初始化文件。然而,继承了登录shell的初始化设置。
登录shell
/etc/profile sehll首先执行/etc/profile中的命令。通过这个文件,root用户可以为全系统内的所有bash用户建立默认特性。
.bash_pro-file .bash_login和.profile然后一次查找~/.bash_pro-file~/.bash_login和~/.profile(~是用户主目录),并执行他找到的首个文件中的命令。这些设置将覆盖/etc/profile中的设置(可以想象成win的用户环境变量覆盖系统环境变量)
.bash_logout
当用户注销时,bash执行文件~/.bash_logout中的命令。他要执行一些清理任务。
交互式非登录shell
交互式非登录shell不执行前面的初始化文件。然而,继承了登录shell的初始化设置。
/etc/bashrc
尽管不是通过bash直接调用许多~/.bashrc文件还是调用了/etc/bashrc。这中安排使得root可以为全系统内的交互式非登陆bashshell建立默认特性。
.bashrc
交互式非登录shell执行~/.bashrc文件,而登录shelll的初始化文件通常会调用这个文件。这样,登录shell和交互式非登录shell都可以使用~/.bashrc文件。
非交互式shell
非交互式非shell不执行前面的初始化文件。然而,继承了登录shell的初始化设置。
相关文章推荐
- /etc/rc.local ; /etc/init.d ;/etc/profile;/etc/bashrc;~/.bash_profile;~/.bashrc;~/.bash_logout
- /etc/profile和/etc/bashrc和~/.bash_profile和~/.bashrc和~/.bash_logout的区别
- /etc/profile,/etc/bashrc,~/.bash_profile,~/.bashrc,~/.bash_logout的区别
- ubuntu 系统 /etc/profile, ~/.profile, ~/.bashrc, ~/.bash_logout,~/.bash_history 文件的内容及解析
- /etc/profile、~/.bashrc、/etc/bashrc、~/.bash_profile、 ~/.bash_login、 ~/.profile、/etc/environment
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc和~/.bash_logout
- 环境配置文件: login, non-login shell, /etc/profile, ~/.bash_profile, source, ~/.bashrc
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- 详解/etc/profile、/etc/bash.bahsrc、~/.profile、~/.bashrc的用途
- 浅析linux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件
- ~/.bashrc, ~/.bash_profile 以及/etc/profile /etc/bashrc 几个文件的区别与相互关系
- Linux下文件 ~/.bashrc 和 ~/.bash_profile 和 /etc/bashrc 和 /etc/profile 的区别 | 用户登录后加载配置文件的顺序
- bashrc,bash_profile和/etc/profile
- 浅析linux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件
- Linux安装软件时,/etc/profile、/etc/bash.bahsrc、~/.profile、~/.bashrc的用途
- cygwin 的 /etc/home/XXXX 目录下没有.bash_profile 、 .inputrc 、 .bashrc 文件
- linux 下/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 干啥的
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- 【shell】/etc/bashrc、~/.bashrc、~/.bash_profile的区别和作用
- 浅析linux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件