From Fedora Project Wiki

< User:Robbinespu

Revision as of 19:27, 28 December 2020 by Robbinespu (talk | contribs) (set proxy)


On this sub-page, I will share my favorite bash setup


This is how I set proxy on my terminal via bash. I have 2 function setproxy and unsetproxy. For example, Here I how I do to set proxy to my university network. Both function also will setup/reset my git config

## set proxy (BASH only not systemwide)
function setproxy() {
	export NO_PROXY='localhost,,::1,*'
	export no_proxy='localhost,,::1,*'
	export {http,https,ftp}_proxy=''

	gsettings set org.gnome.system.proxy mode 'manual'
	gsettings set org.gnome.system.proxy.ftp host ''
	gsettings set org.gnome.system.proxy.ftp port 8080
	gsettings set org.gnome.system.proxy.https host ''
	gsettings set org.gnome.system.proxy.https port 8080
	gsettings set org.gnome.system.proxy.http host ''
	gsettings set org.gnome.system.proxy.http port 8080

	gnome-terminal -x bash -c "git config --global http.proxy \"\""

	echo -e "Proxy environment variable has been setup!"

function unsetproxy() {
	unset {http,https,ftp}_proxy
	unset no_proxy
	unset NO_PROXY

	gsettings set org.gnome.system.proxy mode 'none' 

	gnome-terminal -x bash -c "git config --global http.proxy \"\""

	echo -e "Proxy environment variable removed."