Skip to content

Instantly share code, notes, and snippets.

@likair
Created February 3, 2023 19:24
Show Gist options
  • Save likair/14cf38e1aaefcd3e876365bbbc22a330 to your computer and use it in GitHub Desktop.
Save likair/14cf38e1aaefcd3e876365bbbc22a330 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# This script is used to unset proxy environment variables
# and proxy settings for gnome, apt and docker.
# Unset proxy environment variables
unset http_proxy
unset HTTP_PROXY
unset https_proxy
unset HTTPS_PROXY
unset ftp_proxy
unset FTP_PROXY
unset socks_proxy
unset SOCKS_PROXY
unset all_proxy
unset ALL_PROXY
unset no_proxy
unset NO_PROXY
echo "Set Gnome system proxy as none mode"
gsettings set org.gnome.system.proxy mode 'none';
echo "Remove apt proxy settings"
sudo rm -f /etc/apt/apt.conf.d/proxy
echo "Remove docker proxy settings"
sudo rm -f /etc/systemd/system/docker.service.d/http-proxy.conf
docker info | grep -i "HTTP Proxy:" > /dev/null && (
echo "Reloading docker service..."
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl status docker | grep -i "active (running)" > /dev/null && echo "Docker is running." || echo "Docker is not running, check your settings.")
echo "Checking Internet..."
curl -s -I http://www.google.com | grep -i "HTTP/1.1 200 OK" > /dev/null && echo "Proxy disbled." || echo "Proxy does not work, check your settings."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment