Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Wget is not just for simple file downloads—it also supports powerful options for handling cookies, custom headers, proxies, SSL certificates, and more. These advanced features allow you to script complex workflows, handle authentication securely, or scrape entire directories in locked-down environments. Below are some advanced use cases and examples to help you get the most out of Wget.
These advanced features help you tailor Wget to complex tasks: maintaining authenticated sessions, working with proxies, handling SSL certificates, or automating large-scale downloads. Whether you’re scripting parallel requests or mirroring pages from behind a corporate proxy, Wget’s extensive capabilities allow you to handle nearly any downloading challenge from the command line.
Not: if you’re looking for a more general and basic Wget tutorial and cheat sheet, see this link: The Ultimate Wget Guide and Cheat Sheet.
If you have previously exported browser cookies or used Wget to save cookies, you can use them in subsequent requests:
wget --load-cookies=cookies.txt https://example.com/private/data.zip
To save cookies returned by the server to a file for future use:
wget --save-cookies=auth_cookies.txt --keep-session-cookies https://example.com/login
Sometimes you need to send custom headers (e.g., when accessing APIs):
wget --header="Authorization: Bearer your_token_here" https://api.example.com/data
You can add multiple –header options for different custom headers.
Set the http_proxy environment variable or use the -e option:
export http_proxy="http://proxyserver:port"
wget https://example.com/
Or:
wget -e http_proxy=http://proxyserver:port https://example.com/
You can use torsocks or proxychains to wrap Wget for SOCKS proxy usage:
torsocks wget https://example.com/
For testing or in trusted internal networks:
wget --no-check-certificate https://example.com/
If you have a self-signed certificate or a private CA:
wget --ca-certificate=/path/to/ca.crt https://internal.example.com/
wget -i urls.txt
Wget itself doesn’t provide built-in parallel downloading, but you can pair it with xargs:
xargs -P 4 -n 1 wget < urls.txt
wget --user="username" --password="secret" https://example.com/protected/file.zip
You can place common credentials or default options in your ~/.wgetrc:
user=username
password=secret
Then simply run:
wget https://example.com/protected/file.zip
wget -qO- https://example.com/data.csv | head -n 10
wget -qO- https://example.com/archive.tar.gz | tar xz
wget -r -l 2 -A "*.jpg" https://example.com/gallery/
wget -m -N --timestamping https://example.com/