Linux中添加系统环境变量

Linux中添加系统环境变量

1, 添加临时环境变量

export PATH=$PATH:/usr/local/php/bin

2, 添加永久环境变量

用户环境变量
vim ~/.bash_profile
在文件末尾加上
ipAddress=xxx
全局环境变量
vim /etc/profile
在文件末尾
export ipAddress
设置立即生效
source /etc/profile

image-20221109145957486

3, 查看所有变量

env

4, 查看单个变量

echo $PATH

image-20221109150101163

猜你喜欢

转载自blog.csdn.net/weixin_45285213/article/details/127787975