Linux下与环境变量有关的配置文件
来源:互联网 发布:云计算使用举例 编辑:程序博客网 时间:2024/04/30 00:55
1、
CentOS:
/etc/profile, /etc/bashrc
~/.bashrc, ~/.bash_profile, ~/.bash_logout, ~/bash_history
Ubuntu:
/etc/profile, /etc/bash.bashrc
~/.bashrc, ~/.profile, ~/.bash_logout, ~/bash_history
2、说明(不一定正确)
①CentOS的~/.bash_profile相当于Ubuntu的~/.profile,而且它们都会调用~/.bashrc
②login shell读取配置文件的顺序:/etc/profile ----> ~/.bash_profile(~/.profile)(此外,还调用~/.bashrc)
③non-login shell读取配置文件的顺序(CentOS):/etc/bashrc ----> ~/.bashrc
【参考资料】[Bash: about .bashrc, .bash_profile, .profile, /etc/profile, etc/bash.bashrc and others](http://stefaanlippens.net/bashrc_and_others)
3、关于修改PATH
修改/etc/profile、~/.bashrc、~/.bash_profile都可行(如果想在所有用户的shell下都生效,就编辑/etc/profile文件)
4、. 或 source 命令
. <config_file>
or:
source <config_file>
说明:
(1) 仅对当前shell有效,如果想对所有shell生效,就注销当前用户;如果想永久生效,就重启系统。
(2) 如果修改配置文件使删除某些环境变量,则执行 . 或 source 命令之后这些环境变量依然有效。
CentOS:
/etc/profile, /etc/bashrc
~/.bashrc, ~/.bash_profile, ~/.bash_logout, ~/bash_history
Ubuntu:
/etc/profile, /etc/bash.bashrc
~/.bashrc, ~/.profile, ~/.bash_logout, ~/bash_history
2、说明(不一定正确)
①CentOS的~/.bash_profile相当于Ubuntu的~/.profile,而且它们都会调用~/.bashrc
②login shell读取配置文件的顺序:/etc/profile ----> ~/.bash_profile(~/.profile)(此外,还调用~/.bashrc)
③non-login shell读取配置文件的顺序(CentOS):/etc/bashrc ----> ~/.bashrc
【参考资料】[Bash: about .bashrc, .bash_profile, .profile, /etc/profile, etc/bash.bashrc and others](http://stefaanlippens.net/bashrc_and_others)
3、关于修改PATH
修改/etc/profile、~/.bashrc、~/.bash_profile都可行(如果想在所有用户的shell下都生效,就编辑/etc/profile文件)
4、. 或 source 命令
. <config_file>
or:
source <config_file>
说明:
(1) 仅对当前shell有效,如果想对所有shell生效,就注销当前用户;如果想永久生效,就重启系统。
(2) 如果修改配置文件使删除某些环境变量,则执行 . 或 source 命令之后这些环境变量依然有效。
- Linux下与环境变量有关的配置文件
- Linux 下环境变量配置文件
- linux下环境变量有关命令
- linux下环境变量有关命令
- Linux下共享库(SO)有关的几个环境变量
- Linux下共享库(SO)有关的几个环境变量
- Linux下共享库(SO)有关的几个环境变量
- Linux下共享库(SO)有关的几个环境变量
- Linux下环境变量的设定以及配置文件的修改
- 与环境变量有关的设置
- Linux下设置环境变量各配置文件的区别
- 用户目录下linux环境变量配置文件的异同
- 系统环境变量与个人环境变量的配置文件
- Linux下的环境变量原理与shell
- Linux下的环境变量设置与定制
- 有关linux的环境变量设置问题
- Linux有关环境变量的配置示例
- linux中有关环境变量的一些理解
- 原创:一台cisco 3560多VLAN间通讯的简单配置实例
- C++中char *和char []的区别
- ListView 与 CheckBox
- java 学习资料地址
- 做个好老公,老公对老婆的十大戒条
- Linux下与环境变量有关的配置文件
- libpcap底层实现变化的分析
- 淘宝数据魔方技术架构解析
- 北大ACM poj2676 Sudoku
- ZOJ 3400 Treasure Hunting
- (ZendFramework)使用zf.bat创建工程
- 设计模式1(对象)
- Android中文件的存储与访问
- Android 程序自动更新功能模块实现