wget Cheatsheet - Download, Resume & Mirror Commands
In scripts, what determines whether a download works is not the transfer itself but what happens after it fails, and wget handles that far better than a browser does. The centrepiece is -c: re-running the same command after an interruption sends a Range header and resumes from the last received byte, which is the difference between success and failure on multi-gigabyte artifacts and mirror syncs. Pair it with --tries and --wait to bound retries, --timeout to avoid hanging on a dead connection, and --retry-on-http-error so recoverable 503s and 429s re-enter the retry loop. The recursive group covers -r depth, -np to stay off parent directories, -A and -R filtering, and -e robots=off. The curl boundary is worth drawing: curl wins for a one-shot fetch whose output should flow into a pipeline, while wget is right when you need resume, recursion, mirroring, or a finished file on disk. Whichever you pick, in unattended jobs the first thing to run out is local disk space, not bandwidth.
Basic Download 7
wget URLwget -O filename URLwget -P /path/to/dir URLwget -b URLwget -q URLwget -v URLwget -nc URLResume 3
wget -c URLwget -c -O filename URLwget --continue URLRecursive 8
wget -r URLwget -r -l 2 URLwget -r -np URLwget -r -nd URLwget -r -N URLwget -m URLwget --mirror URLwget -r -H -D example.com URLFilter 6
wget -A "*.pdf,*.doc" URLwget -R "*.tmp,*.log" URLwget --accept-regex ".*\.pdf$" URLwget --reject-regex ".*\.tmp$" URLwget -I /dir1,/dir2 URLwget -X /dir1,/dir2 URLAuth & Proxy 6
wget --user=username --password=pass URLwget --ftp-user=user --ftp-password=pass URLwget -e use_proxy=yes -e http_proxy=URLwget -e use_proxy=yes -e https_proxy=URLwget --no-check-certificate URLwget --user-agent="Mozilla/5.0" URLCommon Patterns 8
wget -i urls.txtwget -r -l 1 -A "*.jpg,*.png" URLwget -r -l 1 --convert-links URLwget -r -l 1 -k -E -p URLwget --limit-rate=100k URLwget --timeout=30 --tries=3 URLwget --spider URLwget -w 2 --random-wait -r URLCommand Examples
Resume a large download
wget -c https://example.com/large.iso-c makes wget send a Range header and pick up where it stopped, and it behaves far better next to --timeout=30 --tries=3. The filename has to stay the same one as before, otherwise -c finds nothing to resume and starts over.
Output
Resuming last request: Length: 1048576000 [1048576000/1048576000] HTTP request sent, awaiting response... 206 Partial Content Length: 1048576000 [1039460352/1048576000] 30.0MB/s eta 00:00:03 1048576000 100%[====] 103.95MB 29.87MB/s
Mirror a page including images and CSS
wget -r -l 1 -k -E -p https://example.com/docs/-k rewrites the page links to local paths, -E saves the pages as .html, -p pulls in images and other assets, and -l 1 caps the recursion at a single level so the crawl cannot run away.
Output
--2026-09-30 15:20:11-- https://example.com/docs/ Resolving example.com (example.com)... 93.184.216.34 Connecting to example.com|93.184.216.34|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 12480 [text/html] Saving to: ‘example.com/docs/index.html’ 2026-09-30 15:20:12 (18.0 MB/s) - 12480 [text/html] saved
Download by file type with a rate limit
wget -r -l 2 -A "*.pdf,*.zip" --limit-rate=500k -P ~/downloads https://example.com/files/-A is the allow list and only the listed types are kept, while --limit-rate is expressed in KB/s, so 500k throttles to roughly 500KB/s. Add -np as well, otherwise the crawler follows parent links and walks straight off the site.
Common Pitfalls
- wget -r without a depth limit or -np can walk off the site and try to download a large part of the internet.
- --no-check-certificate disables verification, allowing man-in-the-middle replacement of downloaded content; debug-only.
- -c resume requires the same filename as the original attempt — renaming restarts the download, and it silently does nothing if the server ignores Range.
- Probe recursive downloads with -l 1 first and confirm the directory structure before widening the scope.
- Check robots.txt and the site terms before recursive downloading; bulk crawling may violate them.
Tips
- wget supports HTTP, HTTPS and FTP, with resume and recursive download.
- Mind the depth (-l) on recursive downloads to avoid pulling too many files.
- Use -m to mirror a site; it auto-handles link conversion and timestamps.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Jul 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us