Linux 环境变量详解

PATH:  环境变量,执行ls等非内置命令式,系统会查找对应的路径是否有

export设置临时的环境变量

[root@localhost ~]# touch /tmp/hello
[root@localhost ~]# chmod +x /tmp/hello 
[root@localhost ~]# export PATH="/tmp:$PATH"
[root@localhost ~]# echo $PATH  

image

 

export设置永久的环境变量

编辑文件: vim /etc/profile
变量生效:source /etc/profile  

image

打印环境变量

echo $PATH    (以冒号为分隔符)

image

原文地址:https://www.cnblogs.com/ftl1012/p/path.html