[Linux]Bash的环境配置文件
[Linux]Bash的环境配置文件
当用户登陆时,将读取以下两个配置文件:
1)/etc/profile:系统全局配置文件,最好不要修改该文件
2)~/.bash_profile或~/.bash_login或~/.profile:用户私有的配置文件
全局配置文件 - /etc/profile
/etc/profile会依次调用下列文件: 1)/etc/inputrc 2)/etc/profile.d/*.sh:如果你需要帮所有用户设置一些共享的命令别名时,可以在这个目录下创建扩展名为.sh的文件 3)/etc/sysconfig/i18n个人配置文件
个人配置文件将根据如下优先级读取,读到一个即停止: 1)~/.bash_profile 2)~/.bash_login 3)~/.profile 其中默认情况下,~/.bash_profile还会读取~/.bashrc,而~/.bashrc又会读取/etc/bashrc手动读取环境配置文件命令 - source或小数点(.)
通过source或小数点(.)可以手动读取配置文件。~/.bash_history: 历史命令记录在这里 ~/.bash_logout:用户注销时执行的命令
评论暂时关闭