Use wget with Squid Proxy Server

How do I make wget work with Squid under UNIX or Linux operating systems?

You need to define the shell variables as follows:

Advertisement

HTTP_PROXY={YOUR-PROXY-Server-IP-HERE}:{YOUR-PROXY-SERVER-Port-Here}
FTP_PROXY={YOUR-PROXY-Server-IP-HERE}:{YOUR-PROXY-SERVER-Port-Here}

You can put above two directives in a file called ~/.wgetrc:
echo 'HTTP_PROXY=192.168.1.254:3128'>> ~/.wgetrc
echo 'FTP_PROXY=192.168.1.254:3128'>> ~/.wgetrc

Now you can use wget:
$ wget http://example.com/file.tar.gz
You can also define shell variables as follows:
export http_proxy=http://192.168.1.254:3128/
OR you can pass the proxy username and password as follows:
wget --proxy-user=YOUR-USERNAME-HERE --proxy-password=YOUR-PASSWORD-HERE http://nixcraft.com/file.tar.gz

See also:

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.