Ubuntu bash的几个初始化文件
来源:互联网 发布:上海网络推广公司排名 编辑:程序博客网 时间:2024/05/21 01:31
Ubuntu bash的几个初始化文件
(1)/etc/profile
全局(公有)配置,不管是哪个用户,登录时都会读取该文件。
(2)/ect/bashrc
Ubuntu没有此文件,与之对应的是/ect/bash.bashrc
它也是全局(公有)的
bash执行时,不管是何种方式,都会读取此文件。
(3)~/.profile
若bash是以login方式执行时,读取~/.bash_profile,若它不存在,则读取~/.bash_login,若前两者不存在,读取~/.profile。
另外,图形模式登录时,此文件将被读取,即使存在~/.bash_profile和~/.bash_login。
(4)~/.bash_login
若bash是以login方式执行时,读取~/.bash_profile,若它不存在,则读取~/.bash_login,若前两者不存在,读取~/.profile。
(5)~/.bash_profile
Unbutu默认没有此文件,可新建。
只有bash是以login形式执行时,才会读取此文件。通常该配置文件还会配置成去读取~/.bashrc。
(6)~/.bashrc
当bash是以non-login形式执行时,读取此文件。若是以login形式执行,则不会读取此文件。
(7)~/.bash_logout
注销时,且是longin形式,此文件才会读取。也就是说,在文本模式注销时,此文件会被读取,图形模式注销时,此文件不会被读取。
下面是在本机的几个例子:
1. 图形模式登录时,顺序读取:/etc/profile和~/.profile
2. 图形模式登录后,打开终端时,顺序读取:/etc/bash.bashrc和~/.bashrc
3. 文本模式登录时,顺序读取:/etc/bash.bashrc,/etc/profile和~/.bash_profile
4. 从其它用户su到该用户,则分两种情况:
(1)如果带-l参数(或-参数,--login参数),如:su -l username,则bash是lonin的,它将顺序读取以下配置文件:/etc/bash.bashrc,/etc/profile和~/.bash_profile。
(2)如果没有带-l参数,则bash是non-login的,它将顺序读取:/etc/bash.bashrc和~/.bashrc
5. 注销时,或退出su登录的用户,如果是longin方式,那么bash会读取:~/.bash_logout
6. 执行自定义的shell文件时,若使用“bash -l a.sh”的方式,则bash会读取行:/etc/profile和~/.bash_profile,若使用其它方式,如:bash a.sh, ./a.sh,sh a.sh(这个不属于bash shell),则不会读取上面的任何文件。
7. 上面的例子凡是读取到~/.bash_profile的,若该文件不存在,则读取~/.bash_login,若前两者不存在,读取~/.profile。
(1)/etc/profile
全局(公有)配置,不管是哪个用户,登录时都会读取该文件。
(2)/ect/bashrc
Ubuntu没有此文件,与之对应的是/ect/bash.bashrc
它也是全局(公有)的
bash执行时,不管是何种方式,都会读取此文件。
(3)~/.profile
若bash是以login方式执行时,读取~/.bash_profile,若它不存在,则读取~/.bash_login,若前两者不存在,读取~/.profile。
另外,图形模式登录时,此文件将被读取,即使存在~/.bash_profile和~/.bash_login。
(4)~/.bash_login
若bash是以login方式执行时,读取~/.bash_profile,若它不存在,则读取~/.bash_login,若前两者不存在,读取~/.profile。
(5)~/.bash_profile
Unbutu默认没有此文件,可新建。
只有bash是以login形式执行时,才会读取此文件。通常该配置文件还会配置成去读取~/.bashrc。
(6)~/.bashrc
当bash是以non-login形式执行时,读取此文件。若是以login形式执行,则不会读取此文件。
(7)~/.bash_logout
注销时,且是longin形式,此文件才会读取。也就是说,在文本模式注销时,此文件会被读取,图形模式注销时,此文件不会被读取。
下面是在本机的几个例子:
1. 图形模式登录时,顺序读取:/etc/profile和~/.profile
2. 图形模式登录后,打开终端时,顺序读取:/etc/bash.bashrc和~/.bashrc
3. 文本模式登录时,顺序读取:/etc/bash.bashrc,/etc/profile和~/.bash_profile
4. 从其它用户su到该用户,则分两种情况:
(1)如果带-l参数(或-参数,--login参数),如:su -l username,则bash是lonin的,它将顺序读取以下配置文件:/etc/bash.bashrc,/etc/profile和~/.bash_profile。
(2)如果没有带-l参数,则bash是non-login的,它将顺序读取:/etc/bash.bashrc和~/.bashrc
5. 注销时,或退出su登录的用户,如果是longin方式,那么bash会读取:~/.bash_logout
6. 执行自定义的shell文件时,若使用“bash -l a.sh”的方式,则bash会读取行:/etc/profile和~/.bash_profile,若使用其它方式,如:bash a.sh, ./a.sh,sh a.sh(这个不属于bash shell),则不会读取上面的任何文件。
7. 上面的例子凡是读取到~/.bash_profile的,若该文件不存在,则读取~/.bash_login,若前两者不存在,读取~/.profile。
- bash的几个初始化文件 - [Ubuntu] 说明
- Ubuntu bash的几个初始化文件
- bash的几个初始化文件
- bash的几个初始化文件
- bash的几个初始化文件浅析
- 几个bash配置文件的说明
- bash的几个特别字符
- Bash常用的几个配置文件
- shell初始化时与配置有关的几个文件
- Win10下的Ubuntu子系统bash调用windows文件
- ubuntu的bash参考手册
- bash初始化文件(Debian Linux)
- shell的初始化文件:/etc/profile和/etc /bashrc(bash.bashrc)
- shell的初始化文件:/etc/profile和/etc/bashrc(bash.bashrc)
- shell的初始化文件:/etc/profile和/etc/bashrc(bash.bashrc)
- Bash的启动文件
- bash的启动文件
- bash shell的几个配置文件的作用
- c#,vb.net 中datagridview绑定datatable
- PC安卓模拟器PANIC: Could not open:C:\Documents and Settings\Administrator\.android/avd/my_avd.ini解决方案
- MFC Socket 类
- PHP--MongoDB
- POJ 1573 Robot Motion
- Ubuntu bash的几个初始化文件
- JS 回到顶部
- spring 中 Hibernate 事务和JDBC事务嵌套问题
- 特性Attribute
- 二叉树转化为完全二叉树
- 如何在游戏机制中使用AI/剧情脚本----基于LUA
- 关于Android UI效果编程与思考 - 整理中
- 专访唐攀:经验之谈 学习嵌入式开发起步指南
- 二叉查找树 BinarySearchTree 实现