linux 设置代理

  • 2020-07-30
  • 浏览 (1057)

linux 或mac 要使用代理可以在 ~/.bash_profile 添加:

function unuseProxy(){
    unset http_proxy
    unset https_proxy
    echo -e "已关闭代理"
}

function useProxy() {
    export http_proxy="http://127.0.0.1:1080"
    export https_proxy=$http_proxy
    echo -e "已开启代理"
}

配置完执行 source ~/.bash_profile,以后要使用代理执行:useProxy,不使用代理:unuseProxy

0  赞