让终端走代理的几种方法
方法1:
在终端中直接运行命令export http_proxy=http://proxyAddress:port
- 1
方法2:
把代理服务器地址写入shell配置文件.bashrc或者.zshrc 直接在.bashrc或者.zshrc添加下面内容export http_proxy="http://localhost:port" export https_proxy="http://localhost:port"以使用shadowsocks代理为例,ss的代理端口为1080,那么应该设置为
export http_proxy="http://127.0.0.1:1080" export https_proxy="http://127.0.0.1:1080"localhost就是一个域名,域名默认指向 127.0.0.1,两者是一样的。 然后ESC后:wq保存文件,接着在终端中执行
source ~/.bashrc
- 1
方法3:
改相应工具的配置,比如apt的配置sudo vim /etc/apt/apt.conf
- 1
Acquire::http::Proxy "http://proxyAddress:port"
- 1
让终端走代理的几种方法
https://www.imsxm.com/archives/let-terminal-connect-with-proxy