1,我们在下载软件时经常遇到更换软件源,
如果我们把整个终端设置在代理环境中,那不就不用换源了吗。
2,在使用一些下载命令时,如you-get经常遇到网络问题,我一直以为是我的DNS的问题,结果检查是我的终端代理被设置成了奇怪的东西!!
查看代理
<code>printenv | grep -i proxy </code>
设置代理
取消代理
<code>unset all_proxy unset ALL_PROXY </code>
仅设置http和https代理(只对当前终端有效)
<code>export http_proxy=http://proxyAddress:port export https_proxy=http://proxyAddress:port </code>
仅设置socks5代理(只对当前终端有效,代理地址假设为socks5://127.0.0.1:1080)
<code>export ALL_PROXY=socks5://127.0.0.1:1080 </code>
通过alias来快速切换
<code>alias setproxy="export ALL_PROXY=socks5://127.0.0.1:1080" alias unsetproxy="unset ALL_PROXY" alias ip="curl -i http://ip.cn" </code>
长期设置需要将上述命令加入bash profile
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!