wget/curl 命令使用代理

设置环境变量:

不带密码:

export http_proxy=http://your-ip-address:port
export https_proxy=https://your-ip-address:port

有密码:

export http_proxy=http://user:password@your-proxy-ip-address:port
export https_proxy=https://user:password@your-proxy-ip-address:port

取消代理

unset http_proxy
unset https_proxy

curl 使用命令行参数:[]内可选部分

protocol: http https socks5
curl -x '<[protocol://] [user:password@] proxyhost[:port] >' url

wget 使用命令行参数:

wget --proxy=on --proxy-user "username" --proxy-password "password" url

wget 使用~/.wgetrc 优先级高于环境变量:

use_proxy = on
proxy_user=username
proxy_password=password
http_proxy =  http://proxy.server.address:port/
https_proxy =  http://proxy.server.address:port/

或者

use_proxy = on
http_proxy =  http://username:password@proxy.server.address:port/
https_proxy =  http://username:password@proxy.server.address:port/

wget 不使用代理命令行参数:

wget --no-proxy FILE_URL