Set http_proxy variables

export http_proxy=http://proxyserver:port
export https_proxy=http://proxyserver:port
export HTTP_PROXY=http://proxyserver:port
export HTTPS_PROXY=http://proxyserver:port
  • The capital ones are required for application compatible

Set http_proxy variables with username/password

export http_proxy=http://USERNAME:PASSWORD@proxyserver:port
export https_proxy=http://USERNAME:PASSWORD@proxyserver:port
export HTTP_PROXY=http://USERNAME:PASSWORD@proxyserver:port
export HTTPS_PROXY=http://USERNAME:PASSWORD@proxyserver:port

In case you have special characters in your username or password , please replace it with percent-encoded one

! # $ % * = ? @
%22 %23 %24 %25 %2A %3D %3F %40

Example :

#FROM
export http_proxy=http://jack:pass@123@proxyserver:port
#TO
export http_proxy=http://jack:pass%40123@proxyserver:port
  • replace @ with %40

Set multiple proxy variables

proxy=http://proxyserver:port
export {http,https,HTTP,HTTPS}_proxy=$proxy

And more

proxy=http://proxyserver:port
export {http,https,ftp,rsync,all}_proxy=$proxy

Set NO_PROXY variable

export no_proxy="127.0.0.1,some.domain:8080,.localdomain.com"
export NO_PROXY="127.0.0.1,some.domain:8080,.localdomain.com"

Set socks5 proxy environment variable

#local dns
export http_proxy=socks5://PROXYSERVER:PORT
#remote dns
export http_proxy=socks5h://PROXYSERVER:PORT