Skip to main content

wget Cheatsheet

By Dejan Panovski Updated on Download PDF

Quick reference for downloading files and mirroring websites with wget

Wget is a command-line utility for downloading files over HTTP, HTTPS, and FTP. It supports recursive downloads, resume, bandwidth limiting, and website mirroring. This cheatsheet covers the most useful commands for everyday use.

Basic Downloads

Download files to the current directory.

CommandDescription
wget URLDownload a file
wget -q URLDownload silently (no output)
wget -nv URLLess verbose (errors and basic info only)
wget -v URLVerbose output (default)
wget -d URLDebug output

Save Options

Control where and how files are saved.

CommandDescription
wget -O name.txt URLSave with a specific filename
wget -O - URLOutput to stdout
wget -P /path/ URLSave to a specific directory
wget --content-disposition URLUse server-suggested filename
wget --no-clobber URLSkip if file already exists
wget -nc URLShort form of --no-clobber

Resume and Speed

Resume interrupted downloads and control bandwidth.

CommandDescription
wget -c URLResume a partial download
wget --limit-rate=2m URLLimit speed to 2 MB/s
wget --limit-rate=500k URLLimit speed to 500 KB/s
wget -b URLDownload in background
wget -b -o log.txt URLBackground with custom log

Multiple Files

Download several files at once.

CommandDescription
wget URL1 URL2 URL3Download multiple URLs
wget -i urls.txtDownload URLs from a file
wget -i - < urls.txtRead URLs from stdin

Recursive Download

Download directory trees and linked pages.

CommandDescription
wget -r URLRecursive download
wget -r -l 2 URLLimit depth to 2 levels
wget -r --no-parent URLDo not ascend to parent directory
wget -r --accept=jpg,png URLAccept only these file types
wget -r --reject=mp4,avi URLReject these file types
wget -r -A "*.pdf" URLDownload only PDFs
wget -r --follow-tags=a URLFollow only <a> tags

Website Mirroring

Create offline copies of websites.

CommandDescription
wget -m URLMirror a website
wget -m -k -p URLMirror with local link conversion
wget -m -k -p -E URLMirror and add .html extensions
wget -m --wait=2 URLMirror with 2 second delay between requests
wget -m --random-wait URLMirror with random delay (0.5x–1.5x of --wait)

Authentication

Access protected resources.

CommandDescription
wget --user=USER --password=PASS URLHTTP basic auth
wget --ask-password URLPrompt for password
wget --header="Authorization: Bearer TOKEN" URLToken auth
wget --ftp-user=USER --ftp-password=PASS URLFTP auth

Headers and User Agent

Send custom headers and change identity.

CommandDescription
wget --header="Key: Value" URLAdd custom header
wget --header="Accept: application/json" URLRequest JSON
wget -U "CustomAgent/1.0" URLChange user agent
wget --referer=URL URLSet referer header

SSL/TLS

Handle HTTPS connections and certificates.

CommandDescription
wget --no-check-certificate URLSkip certificate verification
wget --ca-certificate=ca.crt URLUse custom CA certificate
wget --certificate=client.crt URLClient certificate
wget --private-key=client.key URLClient private key
wget --https-only URLOnly follow HTTPS links

FTP

Work with FTP servers.

CommandDescription
wget ftp://server/fileDownload file
wget -r ftp://server/dir/Download directory recursively
wget --ftp-user=USER --ftp-password=PASS ftp://server/Authenticated FTP
wget --no-passive-ftp ftp://server/fileUse active FTP mode
wget --no-remove-listing ftp://server/dir/Keep .listing files

Retries and Timeouts

Control retry behavior and connection timing.

CommandDescription
wget --tries=5 URLRetry up to 5 times
wget --retry-connrefused URLRetry on connection refused
wget --waitretry=10 URLWait 10 seconds between retries
wget --timeout=30 URLSet all timeouts to 30 seconds
wget --connect-timeout=10 URLConnection timeout only
wget --read-timeout=30 URLRead timeout only
wget --dns-timeout=5 URLDNS timeout only

Output and Logging

Control progress display and log output.

CommandDescription
wget -q URLSuppress all output
wget -nv URLPrint errors and basic info only
wget -o log.txt URLLog output to file
wget -a log.txt URLAppend to log file
wget --show-progress -q URLQuiet but show progress bar
wget --progress=dot URLDot-style progress indicator

Timestamping and Caching

Download only new or updated files.

CommandDescription
wget -N URLDownload only if remote file is newer
wget --no-cache URLDisable server-side caching
wget --spider URLCheck if URL exists (do not download)
wget --spider -r URLCheck all links recursively

Common Patterns

Frequently used command combinations.

CommandDescription
wget -q -O - URL | tar -xzf - -C /pathDownload and extract in one step
wget -c --limit-rate=1m -P /tmp URLResume to directory with speed limit
wget -r -np -nH --cut-dirs=2 URLRecursive without host and path prefix
wget -m -k -p --wait=1 -e robots=off URLFull mirror ignoring robots.txt

Use these articles for detailed wget workflows.

GuideDescription
Wget Command in Linux with ExamplesFull wget tutorial with practical examples
Curl Command in Linux with ExamplesAlternative HTTP client for API interactions
How to Use SCP Command to Securely Transfer FilesTransfer files between hosts over SSH
How to Use Rsync for Local and Remote Data TransferIncremental file sync and transfer