[转]wget/curl命令使用代理

国内机器跑分的时候,有些脚本下载不下来,这时候可以通过使用代理来下载

1、设置环境变量:
不带口令
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

2、取消代理
unset http_proxy
unset https_proxy

3、curl 使用命令行参数:[]内可选部分
protocol: http https socks5
curl -x '<[protocol://][user:password@]proxyhost[:port]>' url

4、wget 使用命令行参数:
wget --proxy=on --proxy-user "username" --proxy-password "password" url

5、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/

6、wget 不使用代理命令行参数:
wget --no-proxy FILE_URL