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

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

wget

Download files and whole sites, resume interrupted transfers, and fetch in the background.

curl

Download files, test APIs, send POST requests with JSON, and inspect headers.

sha256sum & md5sum

Fingerprint files, verify downloads, and prove two files are identical.

More how-to guides

Check disk space in Linux

See how much space is left, and find out what is using it.

Extract a .tar.gz archive

Unpack tar.gz, tar.bz2, tar.xz and zip archives from the command line.

Free a port that is already in use

Find which process holds a port and stop it cleanly.

Find and replace text in files

Replace text in one file or across a whole project, safely.