Wget

We are going to start with one of the most popular tools called wget. It’s a network utility that can be used to download content over HTTPHTTPS and FTPWget can be used in both background and foreground, which makes it useful if you need to leave a download running, even when you are logged off.

This tool comes with plenty of options, that allow you to do an authenticated downloads, recursive downloads with level limits, accepts regular expressions for URLs, allows excludes, accepts URL inputs from a file and many others. The options for wget are really a lot and it is highly recommended to review the tool’s help page by simply running.

$ wget -h
Some useful examples of wget command are:

The most basic download example of wget is:

$ wget https://wordpress.org/latest.zip

Example of downloading from URLs listed in a file. First here is the list of our file:

$ cat list.txt

https://wordpress.org/latest.zip
https://downloads.joomla.org/cms/joomla3/3-8-5/Joomla_3-9-4-Stable-Full_Package.zip
https://ftp.drupal.org/files/projects/drupal-8.4.5.zip

Then you can run the download with:

$ wget -i list.txt

To run a download in a background you can use:

$ wget -b https://wordpress.org/latest.zip

If you want to use wget with FTP to download a single file.

$ wget ftp://user:password@host:/path-to-file/file.txt

A more useful example of this would be to use background and recursive mode so you can obtain all files and folders within a directory.

$ wget -br ftp://user:password@ftp-host:/path-for-download/

Wget is preinstalled on many of the modern Linux distros, but if you need to install it, you can use:

$ sudo apt install wget    # Debian/Ubuntu like distros
# yum install wget         # CentOS/RHEL
# dnf install wget         # Fedora

Leave a Reply

Your email address will not be published.