# 设置shell终端走代理

By [buidlHodler](https://paragraph.com/@buidlhodler) · 2022-02-04

---

环境:

deepin 自带shell , 使用Trojan代理

执行一些脚本不走代理, 本质是执行一些curl ,wget 命令, 底层是http, https 7层协议的代理

**1 修改环境变量, 全局方式**

在 home 目录下的.bashrc文件添加

export all\_proxy="socks5://127.0.0.1:51837"

source ~/.bashrc

测试: curl [www.google.com.hk](http://www.google.com.hk)

**2 设置局部应用走代理**

安装 proxychains 软件 , sudo apt install -y proxychains

编辑 `/etc/proxychains.conf` 文件，在最后的\*\*\[ProxyList\] 增加\*\* socks5 127.0.0.1 1080

在需要走代理的地方,添加 proxychains 命令

proxychains git clone [https://github.com/hijkpw/scripts](https://github.com/hijkpw/scripts)

注意, ping命令是执行三层的icmp协议, 上述方式适用于七层 ip协议

---

*Originally published on [buidlHodler](https://paragraph.com/@buidlhodler/shell)*
