zl程序教程

您现在的位置是:首页 >  系统

当前栏目

Linux 环境变量详解

Linux 详解 环境变量
2023-09-11 14:20:11 时间

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