Wget is a GNU-based free software that has made it possible for numerous Linux-based users to non-interactively download files over the internet or any network without relying on graphical tools like web browsers. Its file download prowess is associated with network/internet protocols like FTP, FTPS, HTTP, and HTTPS.
The primary objective of this article is directly associated with the last stated GNU Wget feature (handling unattended/background operations).
GNU Wget Installation in Linux
This non-interactive file download utility is not pre-installed on your Linux operating system distribution. To install it on various Linux OS distributions, reference the following Wget installation commands:
$ sudo apt install wget [On Debian, Ubuntu and Mint] $ sudo yum install wget [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo emerge -a net-misc/wget [On Gentoo Linux] $ sudo pacman -S wget [On Arch Linux] $ sudo zypper install wget [On OpenSUSE]
GNU Wget Usage in Linux
The general syntax for the usage of the wget command-line-based file download tool is:
$ wget [option]… [URL]...
For instance, if we were to download a random file from let’s say Github and via Wget, we would execute the following command on our Linux terminal:
$ wget https://github.com/zethra/servy/blob/master/README.md
As you might have noted, the above command does not include the [option]
part as addressed in the Wget syntax.
The execution of the above command has yielded a Wget command output detailing things like the targeted filename, file type, file size, download speed, download duration, and time.
To download such a file without the need for is associated command output details, we will take the following approach:
$ wget -q https://github.com/zethra/servy/blob/master/README.md
The Wget command option -q
ensures that no Wget command output is visible on the terminal. We can also confirm the existence of the downloaded file with the command:
$ ls -l README.md
If you are worried about broken downloads, you could add the -c
option to the above command to ensure the complete file download is a success.
$ wget -qc https://github.com/zethra/servy/blob/master/README.md
You can now comfortably use the Wget command to download your files from a Linux environment without dealing with its command output.