How To use “wget” behind an Authenticated Proxy

GNU Wget is a free utility for non-interactive download of files from the Web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies. Wget is non-interactive, meaning that it can work in the background, while the user is not logged on.  This allows you to start a retrieval and disconnect from the system, letting Wget finish the work. By contrast, most of the Web browsers require constant user’s presence, which can be a great hindrance when transferring a lot of data.

In this post we are going to use wget behind a proxy server. Prorxy servers are mainly found in institutions, workplaces and others, where students and users need to be authenticated in other to have access to the internet sometimes restricted from accessing certain websites.

To use wget get behind a proxy server, all you need is:

  • IP address
  • Port
  • Username and Password (Optional in some cases)

Open terminal and run the command below replacing the with your IP and port respectively.

export http_proxy=""

If you need a username and a password to connect to the proxy server you need to add them separated by a colon (:) as shown below:

export http_proxy=""

The above export only works in the current terminal session. To make this available for other new sessions you can add it to your ~/.bash_profile file

Now open terminal to test.

I my case I tried downloading a Windows .exe file as can be read from the text below:

--2015-03-04 14:32:39--
Connecting to connected.
Proxy request sent, awaiting response... 200 OK
Length: 18827245 (18M) [application/x-msdos-program]
Saving to: ‘josm-setup.exe’
100%[======================================>] 18,827,245   163KB/s   in 2m 15s 
2015-03-04 14:34:54 (136 KB/s) - ‘josm-setup.exe’ saved [18827245/18827245]