Are pip and git too slow? A tutorial for configuring Linux terminal proxy
Foreword Development nowadays heavily relies on the internet, but unfortunately, many tools are from abroad, and the access speed is too slow domestically. Therefore, configuring terminal proxies becomes essential. Introduction to ProxyChains ProxyChains is a command-line preloader that hooks into sockets in dynamically linked programs and redirects them through one or more SOCKS/HTTP proxies. GitHub address: https://github.com/rofl0r/proxychains-ng Supports MacOS and Linux.
目录10 个章节
Preface
Development nowadays is heavily dependent on the internet, but unfortunately, many tools are developed abroad, and the access speed from within China is too slow. Therefore, configuring a terminal proxy (终端代理) is quite necessary.
ProxyChains Introduction
ProxyChains is a command-line preloader that hooks into sockets in dynamically linked programs and redirects them through one or more SOCKS/HTTP proxies.
GitHub address https://github.com/rofl0r/proxychains-ng
On macOS and Linux systems, after setting up a Shadowsocks proxy, the PAC (Proxy Auto-Configuration) list can identify the domain names to be proxied. However, this requires the proxy application to support SOCKS5. If it doesn't support SOCKS5, there's no way to proxy it through Shadowsocks. Our Shell console environment does not support SOCKS proxy; it only supports HTTP proxy. If we don't set the http_proxy environment variable in the terminal, our Shell console will not be able to use the Shadowsocks proxy.
Setting http_proxy in Terminal
If you don't mind the extra steps, you can convert a SOCK proxy into an HTTP proxy by setting http_proxy in the terminal. This way, your Shell environment can indirectly use the Shadowsocks proxy as well.
export http_proxy='http://localhost:8888'
export https_proxy='http://localhost:8888'
To disable the proxy:
unset http_proxy
unset https_proxy
If you're interested, you can also add these commands to your .bashrc or .zshrc file to make it more convenient to enable the proxy globally for your Shell console.
Installing Proxychains
Open the terminal and enter the following commands.
git clone https://github.com/rofl0r/proxychains-ng.git
cd proxychains-ng
./configure
make && make install
Configuration Parameters
Modify the configuration in /usr/local/etc/proxychains.conf.
Note: Linux systems do not generate a conf file by default. You need to copy the configuration from ./src/proxychains.conf in the cloned repository to the target directory, or create it manually—both approaches are equivalent.
If the proxychain4 command does not manually specify the configuration file path, it will automatically search for it.
[ProxyList]
Add Proxy Here ...
Meanwhile
defaults set to "tor"
socks4 127.0.0.1 9050
socks5 127.0.0.1 1080 # Set your own proxy address and port here
Generally, it's 1080
## Testing
After `proxychains4` is configured, we can use it in the terminal by adding the command to proxy in the terminal. But does it really proxy everything??? The answer is that it doesn't work on MacOS, while Linux users are already fine.
proxychains4 curl -L tool.lu/ip
The result is shown below:

## Chat With Me
- Live Coding Stream: [https://live.bilibili.com/11883038](https://live.bilibili.com/11883038)
- WeChat Official Account: DealiAxy
- Zhihu: [https://www.zhihu.com/people/dealiaxy](https://www.zhihu.com/people/dealiaxy)
- Blog: [https://blog.deali.cn](https://blog.deali.cn)
- Jianshu: [https://www.jianshu.com/u/965b95853b9f](https://www.jianshu.com/u/965b95853b9f)
_EOF_
Are pip and git too slow? A tutorial for configuring Linux terminal proxy
- 本文作者:
- 程序设计实验室
- 版权声明:
- 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
相关文章
某些软件中无法切换fcitx输入法的问题
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/IMModule':<'fcitx'>}"
2025-10-27 · FAQ & Tips · 约 1 分钟
KDE下OBS直播闪屏解决
关闭避免撕裂即可。 直播效果
2025-10-27 · FAQ & Tips · 约 1 分钟
ModuleNotFoundError--No-module-named-'apt_pkg'-错误解决
前言 今天在安装docker的时候遇到这个问题了,通过搜索解决方案解决了,所以记录一下。 猜测原因应该是今天升级了系统的Python版本,然后python3的软链接也被我改成指向最新版本了。 解决方法 sudo apt-get remove --purge python-apt sudo apt-get install python-apt -f cd /usr/lib/python3/dist
2025-10-27 · FAQ & Tips · 约 1 分钟
How-to-change-mouse-cursor-and-theme-
In order to get your custom cursor to work with all applications do: Download a cursor theme. Extract it to /usr/share/icons or ~/.local/share/icons Open Gnome Tweak Tool and change the cursor theme.
2025-10-27 · FAQ & Tips · 约 1 分钟
讨论
共 0 条加载评论中…