Wget Command Cheat Sheet for Ubuntu

Created by UbuntuFree.com – Visit UbuntuFree.com for more cheat sheets and command guides.

Basic Usage

Download a single file:

wget https://example.com/file.zip

Save file under a new name:

wget -O newname.zip https://example.com/file.zip

Save to a specific directory:

wget -P ~/Downloads https://example.com/file.zip

Download multiple files from a list:

wget -i urls.txt

Download Customization

Resume interrupted download:

wget -c https://example.com/largefile.zip

Limit download speed (e.g., 500KB/s):

wget --limit-rate=500k https://example.com/file.zip

Download in the background:

wget -b https://example.com/largefile.zip

Set number of retry attempts:

wget --tries=15 https://example.com/file.zip

Download numbered files (1–100):

wget https://example.com/image{1..100}.jpg

Use timestamping (only download if newer):

wget -N https://example.com/file.zip

Website Mirroring & Crawling

Mirror entire website:

wget --mirror --convert-links --page-requisites --no-parent https://example.com

Limit recursion depth (e.g., 2 levels):

wget --recursive --level=2 https://example.com

Check for broken links (spider mode):

wget --spider --recursive --no-verbose https://example.com

Authentication & Security

HTTP authentication (protected pages):

wget --user=username --password=pass https://example.com/secure.zip

FTP download with login:

wget --ftp-user=user --ftp-password=pass ftp://example.com/file.zip

Ignore SSL certificate warnings (unsafe):

wget --no-check-certificate https://example.com/file.zip

Spoof user agent (pretend to be a browser):

wget --user-agent=\"Mozilla/5.0\" https://example.com/file.zip

Use proxy for download:

export http_proxy=http://proxy:port\nwget https://example.com/file.zip

Advanced Wget Options

Set timeout for download (in seconds):

wget --timeout=30 https://example.com/file.zip

Set download quota (e.g., 10MB max):

wget --quota=10m https://example.com/files/

Download all files matching pattern (e.g., *.pdf):

wget -r -A.pdf https://example.com/resources/

Log output to a specific file:

wget -o log.txt https://example.com/file.zip

Tip: Use man wget in the terminal to view the full manual with all available options.