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:

ADVERTISEMENTS

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:

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
0 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.