wget
Quick Reference
Command Name:
wget
Category:
networking
Platform:
Linux/Unix/Windows
Basic Usage:
Common Use Cases
- 1
Website mirroring
Create complete offline copies of websites with proper link structure
- 2
Recursive downloads
Download entire directories or sites with controlled depth
- 3
Large file handling
Resume interrupted downloads of large files reliably
- 4
Batch processing
Download multiple files from a list without user interaction
Syntax
wget [options] [URL...]
Options
Option | Description |
---|---|
-V, --version | Display the version of wget |
-h, --help | Print help information |
-b, --background | Go to background after startup |
-e, --execute=COMMAND | Execute a command as if it were part of .wgetrc |
-o, --output-file=FILE | Log messages to FILE |
-a, --append-output=FILE | Append messages to FILE |
-d, --debug | Print debugging information |
-q, --quiet | Turn off output |
-v, --verbose | Be verbose (default) |
-i, --input-file=FILE | Download URLs found in FILE |
-F, --force-html | Treat input file as HTML |
-B, --base=URL | Resolves HTML input file links relative to URL |
-t, --tries=NUMBER | Set number of retries to NUMBER (0 unlimits) |
-O, --output-document=FILE | Write documents to FILE |
-c, --continue | Resume getting a partially-downloaded file |
-P, --directory-prefix=PREFIX | Save files to PREFIX/... |
-r, --recursive | Specify recursive download |
-l, --level=NUMBER | Maximum recursion depth (inf or 0 for infinite) |
--no-parent | Don't ascend to the parent directory |
-A, --accept=LIST | Comma-separated list of accepted extensions |
-R, --reject=LIST | Comma-separated list of rejected extensions |
--limit-rate=RATE | Limit download rate to RATE |
--wait=SECONDS | Wait SECONDS between retrievals |
--random-wait | Wait from 0.5*WAIT to 1.5*WAIT seconds between retrievals |
--mirror | Shortcut for -N -r -l inf --no-remove-listing |
-k, --convert-links | Make links in downloaded HTML point to local files |
-p, --page-requisites | Get all images, etc. needed to display HTML page |
--user=USER | Set both FTP and HTTP user to USER |
--password=PASS | Set both FTP and HTTP password to PASS |
Examples
How to Use These Examples
The examples below show common ways to use the wget
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
wget https://example.com/file.zip
Download a file and save it to the current directory.
wget -O custom_name.zip https://example.com/file.zip
Download a file and save it with a custom name.
wget -P /path/to/directory https://example.com/file.zip
Download a file to a specific directory.
Advanced Examples:
wget -c https://example.com/largefile.zip
Resume a previously interrupted download.
wget -r -np -k https://example.com/
Recursively download a website (mirroring) while converting links for local viewing.
wget --limit-rate=200k https://example.com/largefile.zip
Limit the download speed to 200 KB/s.