wget Cheatsheet
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.
| Command | Description |
|---|---|
wget URL | Download a file |
wget -q URL | Download silently (no output) |
wget -nv URL | Less verbose (errors and basic info only) |
wget -v URL | Verbose output (default) |
wget -d URL | Debug output |
Save Options
Control where and how files are saved.
| Command | Description |
|---|---|
wget -O name.txt URL | Save with a specific filename |
wget -O - URL | Output to stdout |
wget -P /path/ URL | Save to a specific directory |
wget --content-disposition URL | Use server-suggested filename |
wget --no-clobber URL | Skip if file already exists |
wget -nc URL | Short form of --no-clobber |
Resume and Speed
Resume interrupted downloads and control bandwidth.
| Command | Description |
|---|---|
wget -c URL | Resume a partial download |
wget --limit-rate=2m URL | Limit speed to 2 MB/s |
wget --limit-rate=500k URL | Limit speed to 500 KB/s |
wget -b URL | Download in background |
wget -b -o log.txt URL | Background with custom log |
Multiple Files
Download several files at once.
| Command | Description |
|---|---|
wget URL1 URL2 URL3 | Download multiple URLs |
wget -i urls.txt | Download URLs from a file |
wget -i - < urls.txt | Read URLs from stdin |
Recursive Download
Download directory trees and linked pages.
| Command | Description |
|---|---|
wget -r URL | Recursive download |
wget -r -l 2 URL | Limit depth to 2 levels |
wget -r --no-parent URL | Do not ascend to parent directory |
wget -r --accept=jpg,png URL | Accept only these file types |
wget -r --reject=mp4,avi URL | Reject these file types |
wget -r -A "*.pdf" URL | Download only PDFs |
wget -r --follow-tags=a URL | Follow only <a> tags |
Website Mirroring
Create offline copies of websites.
| Command | Description |
|---|---|
wget -m URL | Mirror a website |
wget -m -k -p URL | Mirror with local link conversion |
wget -m -k -p -E URL | Mirror and add .html extensions |
wget -m --wait=2 URL | Mirror with 2 second delay between requests |
wget -m --random-wait URL | Mirror with random delay (0.5x–1.5x of --wait) |
Authentication
Access protected resources.
| Command | Description |
|---|---|
wget --user=USER --password=PASS URL | HTTP basic auth |
wget --ask-password URL | Prompt for password |
wget --header="Authorization: Bearer TOKEN" URL | Token auth |
wget --ftp-user=USER --ftp-password=PASS URL | FTP auth |
Headers and User Agent
Send custom headers and change identity.
| Command | Description |
|---|---|
wget --header="Key: Value" URL | Add custom header |
wget --header="Accept: application/json" URL | Request JSON |
wget -U "CustomAgent/1.0" URL | Change user agent |
wget --referer=URL URL | Set referer header |
SSL/TLS
Handle HTTPS connections and certificates.
| Command | Description |
|---|---|
wget --no-check-certificate URL | Skip certificate verification |
wget --ca-certificate=ca.crt URL | Use custom CA certificate |
wget --certificate=client.crt URL | Client certificate |
wget --private-key=client.key URL | Client private key |
wget --https-only URL | Only follow HTTPS links |
FTP
Work with FTP servers.
| Command | Description |
|---|---|
wget ftp://server/file | Download 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/file | Use active FTP mode |
wget --no-remove-listing ftp://server/dir/ | Keep .listing files |
Retries and Timeouts
Control retry behavior and connection timing.
| Command | Description |
|---|---|
wget --tries=5 URL | Retry up to 5 times |
wget --retry-connrefused URL | Retry on connection refused |
wget --waitretry=10 URL | Wait 10 seconds between retries |
wget --timeout=30 URL | Set all timeouts to 30 seconds |
wget --connect-timeout=10 URL | Connection timeout only |
wget --read-timeout=30 URL | Read timeout only |
wget --dns-timeout=5 URL | DNS timeout only |
Output and Logging
Control progress display and log output.
| Command | Description |
|---|---|
wget -q URL | Suppress all output |
wget -nv URL | Print errors and basic info only |
wget -o log.txt URL | Log output to file |
wget -a log.txt URL | Append to log file |
wget --show-progress -q URL | Quiet but show progress bar |
wget --progress=dot URL | Dot-style progress indicator |
Timestamping and Caching
Download only new or updated files.
| Command | Description |
|---|---|
wget -N URL | Download only if remote file is newer |
wget --no-cache URL | Disable server-side caching |
wget --spider URL | Check if URL exists (do not download) |
wget --spider -r URL | Check all links recursively |
Common Patterns
Frequently used command combinations.
| Command | Description |
|---|---|
wget -q -O - URL | tar -xzf - -C /path | Download and extract in one step |
wget -c --limit-rate=1m -P /tmp URL | Resume to directory with speed limit |
wget -r -np -nH --cut-dirs=2 URL | Recursive without host and path prefix |
wget -m -k -p --wait=1 -e robots=off URL | Full mirror ignoring robots.txt |
Related Guides
Use these articles for detailed wget workflows.
| Guide | Description |
|---|---|
Wget Command in Linux with Examples | Full wget tutorial with practical examples |
Curl Command in Linux with Examples | Alternative HTTP client for API interactions |
How to Use SCP Command to Securely Transfer Files | Transfer files between hosts over SSH |
How to Use Rsync for Local and Remote Data Transfer | Incremental file sync and transfer |