linux取消设置环境变量,linux设置环境变量

1.临时生效性(只对当前会话有效)

export http_proxy="socks://192.168.0.1:10808"

2.永久生效性

(1)在/etc/profile尾部添加(这个文件是每个用户登录时都会运行的环境变量)

export http_proxy="socks://192.168.0.106:10808"

export https_proxy="socks://192.168.0.106:10808"

(2)在/etc/profile.d/下面添加一个.sh文件

比如/etc/profile.d/edison_proxy.sh

里面的内容是:

export http_proxy="socks://192.168.0.106:10808"

export https_proxy="socks://192.168.0.106:10808"

export http_proxy="http://localhost:10809"

export https_proxy="https://localhost:10809"

unset http_proxy

unset https_proxy

设置环境变量用export,相对应取消环境变量则用unset,

查看环境变量用$,其他同上。

备注:

永久生效的方法需要在编辑、添加好文件后执行source 命令:

source /etc/profile或者source /etc/profile.d/edison_proxy.sh才会生效

其他已存在会话窗口想要让上述环境变量生效也必须执行source命令

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值