Linux下配置文件 /etc/profile、/etc/bashrc、~/.bash_profile、~/.profile、~/.bashrc 总结
来源:互联网 发布:macbook怎么卸载软件 编辑:程序博客网 时间:2024/06/05 14:30
系统级环境变量配置文件
/etc/profile:系统级全局环境变量配置文件,不只是包含shell配置信息,还可以包含比如JAVA_HOME之类的配置等等,所有用户通用;
系统级bash环境变量运行时配置文件
/etc/bashrc:系统级全局bash环境变量配置文件,是针对指定的shell(这里是bash)的配置文件,所有用户通用;
用户级环境变量配置文件
~/.profile :用户级全局环境变量配置文件,用户自己的各种环境变量的配置文件
~/.bash_profile:用户级bash环境变量配置文件,针对的是用户使用的bash,其他shell应该有相关对应的配置文件
若bash是以login方式执行时,读取~/.bash_profile,若它不存在,则读取~ /.bash_login,若前两者不存在,读取~ /.profile。
用户级bash运行时环境变量配置文件
~/.bashrc:用户级bash运行时环境变量配置文件,这里是这对bash运行时设置的配置文件
总结:
在Linux中配置文件分为:系统级配置文件和用户级配置文件,如果用户级配置文件,优先使用用户级配置文件,否则使用系统统一的配置文件
在Linux中配置文件还可以分为:系统级运行时配置文件和用户级运行时配置文件,如果用户级运行时配置文件存在,优先使用用户级配置文件,否则使用系统级运行时配置文件。
在Linux中还存在一种配置文件用来保存用户的使用记录等,这个主要有两个地方:一个是history,一个是编辑器 比如.viminfo 通过这些操作记录可以查看或者复原一些之前的状态
补充说明:
1、/etc/profile 配置文件是系统级别的,/etc/bashrc是shell级别的,而且这两个配置都是全局的,并且不推荐直接修改这两个文件,因为他们在将来可能会被改动,但是/etc/profile配置文件总是会读取 /etc/profile.d目录下面的所有配置文件
而目录/etc/profile.d目录下面则是针对不同类型的shell进行的客户自定义设置内容,并且这里的设置也是全局的(全局是针对所有用户的,用户自己特有的设置需要保存在用户自己的家目录下面,并且命名为英文字符点开头的文件)
2、配置history条数,并设置显示时间
在/etc/profile.d目录下面新建history.sh,表示针对bash进行的设置,内容如下
HISTSIZE=50000
HISTTIMEFORMAT="%F %T "
export HISTSIZE HISTTIMEFORMAT
退出后重新登录即可生效。
- Linux下配置文件 /etc/profile、/etc/bashrc、~/.bash_profile、~/.profile、~/.bashrc 总结
- Linux /etc/profile,~/.bash_profile,~/.bashrc,/etc/bashrc
- 浅析linux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- Linux下/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc的区别
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 比较
- /etc/profile /etc/bashrc ~/.bash_profile ~/.bashrc 区别
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- /etc/profile,/etc/bashrc,~/.bash_profile,~/.bashrc
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- /etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc
- Linux —— /etc/profile、/etc/bashrc、.bash_profile、.bashrc理解
- /etc/profile、~/.bashrc、/etc/bashrc、~/.bash_profile、 ~/.bash_login、 ~/.profile、/etc/environment
- 浅析linux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文件
- 浅析linux 下的/etc/profile、/etc/bashrc、~/.bash_profile、~/.bashrc 文...
- zlib安装和使用 linux
- JavaScript中的公有成员,私有成员和静态成员
- Java本地方法理解及通过JNI的简单实现
- 大家伙们都慌得发抖了,因为未来5年颠覆者无处不在
- ipad 按钮切换时 有闪动效果
- Linux下配置文件 /etc/profile、/etc/bashrc、~/.bash_profile、~/.profile、~/.bashrc 总结
- javascript之冒泡排序算法
- [计算机网络-1] TCP/IP数据包格式详解-包括数据链路层的头部
- java如何实现日期格式和字符串之间的转化
- 在ubuntu中关于错改了环境变量,shell命令找不到
- 将一点点改变自己
- struts2 清空 提交的 实体 仍回显
- thinkphp下widget扩展的使用
- PHP安装eAccelerator