This guide explains system-wide proxy on Linux desktop environments (GNOME, KDE) and command-line tools. We cover manual HTTP/SOCKS proxies, PAC auto-config, environment variables, and troubleshooting—so you can route traffic reliably.
Linux has multiple layers: desktop environment proxy (affects browsers like Chrome, many apps), per-app proxy (e.g., Firefox), and CLI tools via environment variables or per-tool configs (apt, yum, wget, curl, git). If your proxy works in Chrome but not in a terminal command, configure the CLI environment as well.
Tip: Use “Ignore Hosts” to bypass proxy for local domains.
Export these variables to route CLI tools through your proxy:
# HTTP proxy
export http_proxy=http://USER:PASS@HOST:PORT
export https_proxy=http://USER:PASS@HOST:PORT
# SOCKS5 proxy (for tools that support it, e.g., curl with --socks5)
export all_proxy=socks5://USER:PASS@HOST:PORT
# Persist in shell profile (~/.bashrc or ~/.zshrc):
# echo 'export http_proxy=...' >> ~/.bashrc && source ~/.bashrc
Note: Use lowercase and uppercase variants for broader compatibility (HTTP_PROXY/HTTPS_PROXY).
sudo mkdir -p /etc/apt/apt.conf.d
sudo tee /etc/apt/apt.conf.d/95proxies << 'EOF'
Acquire::http::Proxy "http://HOST:PORT";
Acquire::https::Proxy "http://HOST:PORT";
EOF
sudo tee -a /etc/dnf/dnf.conf << 'EOF'
proxy=http://HOST:PORT
EOF
# For legacy yum:
sudo tee -a /etc/yum.conf << 'EOF'
proxy=http://HOST:PORT
EOF
tee -a ~/.wgetrc << 'EOF'
http_proxy = http://HOST:PORT
https_proxy = http://HOST:PORT
use_proxy = on
EOF
tee -a ~/.curlrc << 'EOF'
proxy = http://HOST:PORT
# or socks5 proxy:
# socks5 = USER:PASS@HOST:PORT
EOF
# Global proxy
git config --global http.proxy http://HOST:PORT
git config --global https.proxy http://HOST:PORT
# Per-repo (run inside repository)
git config http.proxy http://HOST:PORT
git config https.proxy http://HOST:PORT
Desktop environments may support Automatic Proxy Configuration via a PAC URL; browsers like Chrome/Firefox can also apply PAC files. Enter your PAC URL where supported and verify via What's My IP.
Export http_proxy/https_proxy variables and configure per-tool settings (APT, DNF/YUM, wget, curl, git).
Many apps have their own network settings—configure the app directly or consult documentation.
Turn off proxies in GNOME/KDE settings, unset environment variables (unset http_proxy https_proxy all_proxy), and remove per-tool config entries.