How to Download a File with wget in Linux
Download files from HTTP or HTTPS with wget and save them to a chosen location.
wget is designed around unattended downloads and is especially convenient in shell scripts. Its defaults are simple: provide a URL and it writes the response to a local file.
Step by step
1 Download a file
$ wget https://example.com/file.tar.gz Downloads the URL into the current directory.
2 Choose the output filename
$ wget -O release.tar.gz https://example.com/download The -O option writes the response to the exact path you specify.
3 Continue a partial download
$ wget -c https://example.com/large.iso The -c option resumes an existing partial file when the server supports range requests.
4 Download quietly in a script
$ wget -q -O release.tar.gz https://example.com/release Quiet mode reduces terminal output while the explicit destination makes the result predictable.
Tips worth knowing
- Check the downloaded file type with `file` before extracting it.
- Use checksums when the publisher provides them.
- For API requests and complex HTTP interactions, curl is usually the more flexible choice.
Frequently asked questions
How do I download a file with wget?
Use `wget URL`.
How do I rename the downloaded file?
Use `wget -O local-name URL`.
Can wget resume downloads?
Yes, `wget -c URL` can continue a partial download when the server supports it.
The commands behind it
Download files and whole sites, resume interrupted transfers, and fetch in the background.
curlDownload files, test APIs, send POST requests with JSON, and inspect headers.
sha256sum & md5sumFingerprint files, verify downloads, and prove two files are identical.
More how-to guides
See how much space is left, and find out what is using it.
Extract a .tar.gz archiveUnpack tar.gz, tar.bz2, tar.xz and zip archives from the command line.
Free a port that is already in useFind which process holds a port and stop it cleanly.
Find and replace text in filesReplace text in one file or across a whole project, safely.