在终端环境下,常会遇到要下载某个文件巨慢,甚至无法连接,急需一个方案来拯救.
临时
# 协议填http或socks5 export http_proxy="http://127.0.0.1:10809" export https_proxy="https://127.0.0.1:10809" export http_proxy="socks5://127.0.0.1:10808" export https_proxy="socks5://127.0.0.1:10808" # 让环境生效 source /etc/profile # ping是ICMP报文,代理不转发 # 检查终端是否处于代理状态 curl cip.cc
或使用 alias
alias
alias setproxy='export ALL_PROXY=socks5://127.0.0.1:10808' alias unsetproxy='unset ALL_PROXY'
# 查找本机ip 最后的nameserver就是ip cat /etc/resolv.conf # 协议填http或sock export http_proxy="http://ip:port" export https_proxy="http://ip:port" # 让环境生效 source /etc/profile
Linux 让终端走代理的几种方法
Last updated 7 months ago