.bashrc文件
.bashrc和.bash_profile文件的区别是
每次打开bash, ~/.bashrc文件都会运行
而~/.bash_profile是仅在首次登录系统时运行
.bash_profile文件
在用户的home目录下,有一个.bash_profile文件,用于登录bash shell时设置环境变量。
$ vi ~/.bash_profile
输出示例:
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH
可以看到,设置了PATH变量。
/etc/profile文件
/etc/profile文件是系统范围的shell配置文件。
对所有bash用户都有效。
而.bashrc和.bash_profile文件只对单独用户有效。
Linux在哪里设置环境变量?
BASH Shell如何为所有用户设置全局配置文件?
CentOS ,Solaris中 .bashrc和.bash_profile文件有什么区别?
日期:2019-11-20 08:53:07 来源:oir作者:oir