Terminal environment variables
Proxy variables for bash, zsh, fish, PowerShell and cmd.
Most command-line tools read http_proxy / https_proxy / all_proxy (some use upper case, some lower case, so set both).
bash / zsh
export http_proxy=http://127.0.0.1:7898
export https_proxy=http://127.0.0.1:7898
export all_proxy=socks5://127.0.0.1:7898
export HTTP_PROXY=$http_proxy HTTPS_PROXY=$https_proxy ALL_PROXY=$all_proxy
export no_proxy=localhost,127.0.0.1,::1
export NO_PROXY=$no_proxyAs on/off functions in ~/.zshrc or ~/.bashrc:
proxy_on() { export http_proxy=http://127.0.0.1:7898 https_proxy=http://127.0.0.1:7898 all_proxy=socks5://127.0.0.1:7898; export HTTP_PROXY=$http_proxy HTTPS_PROXY=$https_proxy ALL_PROXY=$all_proxy; echo "proxy on"; }
proxy_off() { unset http_proxy https_proxy all_proxy HTTP_PROXY HTTPS_PROXY ALL_PROXY; echo "proxy off"; }On Linux you can simply run:
eval "$(cnb env)" # set
eval "$(cnb env --unset)" # unsetfish
set -gx http_proxy http://127.0.0.1:7898
set -gx https_proxy http://127.0.0.1:7898
set -gx all_proxy socks5://127.0.0.1:7898
# Linux
cnb env --shell fish | sourceWindows PowerShell
$env:HTTP_PROXY = "http://127.0.0.1:7898"
$env:HTTPS_PROXY = "http://127.0.0.1:7898"
$env:NO_PROXY = "localhost,127.0.0.1"Windows cmd
set HTTP_PROXY=http://127.0.0.1:7898
set HTTPS_PROXY=http://127.0.0.1:7898Verify
curl -sI https://github.com | head -1