Configure proxy

export http_proxy=http://10.203.0.1:5187/
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
export PROXY_SERVER=192.168.0.222
export PROXY_USER=foo
export PROXY_PASS=bar
 
cat <<EOF>> /etc/environment
export http_proxy="http://${PROXY_USER}:${PROXY_PASS}@${PROXY_SERVER}:8080"
export https_proxy="http://${PROXY_USER}:${PROXY_PASS}@${PROXY_SERVER}:8080"
export no_proxy="localhost,127.0.0.1,foo.example.com"
EOF
 
cat <<EOF> /etc/apt/apt.conf.d/12proxy
Acquire::http::Proxy "http://${PROXY_USER}:${PROXY_PASS}@${PROXY_SERVER}:8080";
Acquire::https::Proxy "http://${PROXY_USER}:${PROXY_PASS}@${PROXY_SERVER}:8080";
EOF

Set http_proxy with special characters in password
https://www.cyberciti.biz/faq/unix-linux-export-variable-http_proxy-with-special-characters/
https://www.fourmilab.ch/webtools/unum/

#wget https://www.fourmilab.ch/webtools/unum/download/unum.tar.gz
#tar xzf unum.tar.gz
#./unum.pl 'F@o:o!B#ar$'
 
MY_NEW_PASS='F@o:o!B#ar$' 
echo ${MY_NEW_PASS}| uni2ascii -qp | sed 's/0x00/%/g'
 
#Replace with:
#F%40o%3Ao%21B%23ar%24

Socks

ssh -N -D 8080 proxy.example.com
 
export https_proxy=socks5://127.0.0.1:8080

Links
https://www.cyberciti.biz/faq/linux-unix-set-proxy-environment-variable/