# set http proxy
export http_proxy=http://127.0.0.1:8080
# set socks proxy (local DNS)
export http_proxy=socks5://127.0.0.1:1080
# set socks proxy (remote DNS)
export http_proxy=socks5h://127.0.0.1:1080
export https_proxy=$http_proxy \
ftp_proxy=$http_proxy \
rsync_proxy=$http_proxy \
all_proxy=$http_proxy
export no_proxy="127.0.0.1,localhost,localaddress,.localdomain.com"
export HTTP_PROXY=$http_proxy \
HTTPS_PROXY=$http_proxy \
FTP_PROXY=$http_proxy \
RSYNC_PROXY=$http_proxy \
ALL_PROXY=$http_proxy \
NO_PROXY=$no_proxy
# set git http(s) proxy
git config --global http.sslverify false
git config --global http.proxy $http_proxy
git config --global https.proxy $http_proxy
# only for 'github.com'
git config --global http.https://github.com.proxy $http_proxy
# use 'nc' with http protocol
export ssh_proxy='ProxyCommand=nc -X connect -x PROXYHOST:PROXYPORT %h %p'
# use 'nc' with socks5 protocol
export ssh_proxy='ProxyCommand=nc -X 5 -x PROXYHOST:PROXYPORT %h %p'
# use 'connect' with http protocol
export ssh_proxy='ProxyCommand=connect -H PROXYHOST:PROXYPORT %h %p'
# use 'connect' with socks5 protocol
export ssh_proxy='ProxyCommand=connect -S PROXYHOST:PROXYPORT %h %p'
# connect to ssh server over proxy
ssh -o $ssh_proxy USER@FINAL_DEST
unset http_proxy https_proxy ftp_proxy rsync_proxy all_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY RSYNC_PROXY ALL_PROXY
git config --global --unset http.proxy
git config --global --unset https.proxy
git config --global --unset http.https://github.com.proxy
unset ssh_proxy
A remind:
/etc/environmentis not a script. It only supports KEY=VALUE syntax ($variable is not supported either)/etc/profiledoes not supportexport {HTTP,HTTPS,FTP,RSYNC,ALL}_PROXY=$http_proxy, it may hang your login