Getting Started with The Wget Command in Linux
What is Wget?
Wget is a command line utility for downloading files from the web. It’s widely used to automate download tasks, as in: downloading multiple files, mirroring a website, downloading all images from a website, etc. Wget supports HTTP, HTTPS and FTP protocol, so you can use it for downloading files from websites and FTP servers.
How Wget works?
Wget works by making requests to the webserver and then fetching the data via the FTP or HTTP protocol. The program then processes the downloaded data and save it to your local drive. Wget also has features to recursively download and mirror a website, resume unfinished downloads, limit download speed and much more.
Usage of Wget command
The most basic use of wget command is to download a single file from a given URL:
wget http://example.com/example.html
You can also download multiple files at once, by providing multiple URLs seperated by space. For example:
wget http://example.com/example1.html http://example.com/example2.html
If you want to download a whole website, you can use the -m (or --mirror) option to mirror a remote website locally on your machine. For example:
wget -m http://example.com
You can also use the –c (or --continue) option to continue an interrupted download process. This will allow the download process to resume the download from where it left off.
wget -c http://example.com/example.html
Finally, you can use various options to limit the download speed. For example, this command sets the download speed to 2MB/s:
wget --limit-rate=2M http://example.com/example.html
These are just some of the basic uses of the Wget command. There are many more options available that you can explore.