linux /etc/profile,bashrc等文件的加载流程 以及 环境变量的设置
来源:互联网 发布:英文域名注册查询 编辑:程序博客网 时间:2024/04/30 16:25
作者:spawpaw@hotmail.com 转载需注明出处
永久更新地址http://blog.csdn.net/qq_29753285/article/details/69367215
因为最近在debian上设置java环境变量,研究了一下profile等文件的加载流程
其实在ubuntu上也很相似,其他发行版的linux没有研究过。
环境变量一般在profile文件中设置,
- 如果只想本次登陆shell有效,直接在shell中输入
export 变量名=变量值1[:变量值2[:...]]
- 如果只想对当前用户生效,就在
~/.profile
中设置, - 如果想让设置对所有用户生效,就在
etc/profile
中设置。
设置的方法很简单,只要在文件末尾按照如下语法添加
export 变量名=变量值1[:变量值2[:...]]
例如为所有用户添加java环境变量(注意,多个变量之间是用冒号分隔,而不是分号):
#在/etc/profile 的末尾追加如下内容,JAVA_HOME改成你自己java的目录export JAVA_HOME=/usr/share/jdk1.8export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
各个文件的加载顺序(其实系统启动时只加载了profile文件,然后profile文件递归加载了其余的文件):

0 0
- linux /etc/profile,bashrc等文件的加载流程 以及 环境变量的设置
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- linux 环境变量 /etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux下 环境变量/etc/profile、/etc/bashrc、~/.bashrc的区别
- Linux环境变量设置/etc/profile、/etc/bashrc、~/.profile、~/.bashrc区别
- /etc/profile,/etc/environment,.bash_profile及.bashrc等与环境变量有关的文件的比较
- linux环境变量设置,/etc/profile,/etc/bashrc和.bash_profile的区别(作用域)
- Linux的环境变量.bash_profile .bashrc profile文件
- Linux环境变量知识:/root/.bashrc与/etc/profile的异同
- Linux环境变量配置的三个方法--/etc/profile,~/.bashrc,shell
- LInux中 ~/.profile ~/.bashrc /etc/profile /etc/bashrc 的区别
- linux的环境变量文件enviroment 、profile、bashrc和.bashrc以及.bash_profile
- linux设置了 /etc/profile ~/.bashrc等配置文件不重启生效方法【开机读取的shll】
- non-saturated function in AlexNet
- 矩阵求导法则
- 文章标题
- 杭电1010,深度优先搜索+减枝
- C++this指针详解
- linux /etc/profile,bashrc等文件的加载流程 以及 环境变量的设置
- Linux用Tomcat重新启动脚本
- leetcode 120
- Java 实例
- 版本控制软件 perforce 与 git
- arm-linux-gcc/ld/objcopy/objdump使用总结
- GitHub删除仓库小技巧
- 基于vue+vue-router+vuex+axios+webpack开发的个人Demo《Qu约》
- 二叉数的先序、中序、后序遍历