Wget with Proxy

command line

Wget is an elegant command line tool for downloading files over HTTP, HTTPs or FTP. Many of us are using it to just to get or reget files (reget means continue downloading of partially-downloaded file), save web pages with all contents (known as recursive download). Wget can also be used to download files via proxy. It takes address of the proxy from environment variable so in order to download something through proxy use the following syntax:

http_proxy="http://192.168.0.1:8080" wget 

or

export http_proxy=http://192.168.0.1:8080/
wget 

Both commands will download file in the same way (through proxy) but the latter will save proxy for current session so you’ll be able to download other files without need to specify http_proxy environment variable again.

If you need to make this setup permanent even after logout or restart just add line export http_proxy=http://192.168.0.1:8080/ into ~/.bashrc file that stores your command line settings.

SHARE:
nv-author-image

Stefan Durand

My name is Stefan, I'm the admin of LinuxScrew. I am a full-time Linux/Unix sysadmin, a hobby Python programmer, and a part-time blogger. I post useful guides, tips, and tutorials on common Linux and Programming issues. Feel free to reach out in the comment section.

Leave a Reply

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