How to use wget to download a file from a website?

Published on Aug. 22, 2023, 12:17 p.m.

To use wget to download a file from a website, you can use the following command line syntax:

wget [options] [URL]

Where [options] are optional parameters you can use to specify things like the output file name, download location and protocol, and [URL] is the URL of the file that you want to download.

For example, the following command will download a file named example.zip from a URL https://www.example.com/example.zip and save it to the current directory:

wget https://www.example.com/example.zip

You can use the -P option to specify a download location path like this:

wget -P /path/to/download https://www.example.com/example.zip

Alternatively, you can use the -O option to specify the output file name like this:

wget -O newfilename.zip https://www.example.com/example.zip

These are just some basic examples, and you can check the wget man page for more options.

Tags: