The Ultimate Guide to Linux Proxy Settings (Desktop & CLI)

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.

System-Wide vs. App-Specific Proxies

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.

Method 1: Desktop Proxy (GNOME)

  1. Open SettingsNetwork.
  2. Click Network Proxy.
  3. Select Manual and fill:
    • HTTP: server, port
    • HTTPS: server, port
    • SOCKS: server, port (for SOCKS5)
  4. Apply changes, then verify via What's My IP.

Tip: Use “Ignore Hosts” to bypass proxy for local domains.

Method 2: Desktop Proxy (KDE Plasma)

  1. Open System SettingsNetworkProxy.
  2. Choose Manual and enter HTTP/HTTPS/SOCKS server and port values.
  3. Apply, restart apps if needed, and verify via What's My IP.

Method 3: Command Line (Environment Variables)

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).

Method 4: Per-Tool Proxy Configuration

APT (Debian/Ubuntu)

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

DNF/YUM (Fedora/CentOS/RHEL)

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

Wget

tee -a ~/.wgetrc << 'EOF'
http_proxy = http://HOST:PORT
https_proxy = http://HOST:PORT
use_proxy = on
EOF

cURL

tee -a ~/.curlrc << 'EOF'
proxy = http://HOST:PORT
# or socks5 proxy:
# socks5 = USER:PASS@HOST:PORT
EOF

Git

# 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

Method 5: Automatic Proxy (PAC File)

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.

Troubleshooting Common Linux Proxy Issues

Issue 1: "CLI tools ignore my desktop proxy."

Export http_proxy/https_proxy variables and configure per-tool settings (APT, DNF/YUM, wget, curl, git).

Issue 2: "Proxy works in Chrome but fails in a specific app."

Many apps have their own network settings—configure the app directly or consult documentation.

Issue 3: "How do I disable the proxy?"

Turn off proxies in GNOME/KDE settings, unset environment variables (unset http_proxy https_proxy all_proxy), and remove per-tool config entries.