How To Use WGET Command on Linux
The Wget command is one of the most used commands for download management in Linux environments, and since 1996 it has not left its power, security, and scope.
With wget, we have various options for execution in Linux environments, but today we already have access to Mac OS and Windows 10.
The use of commands allows our tasks to be straightforward, sometimes sharing functionality regardless of the operating system.
In this opportunity, we will analyze how we can use Wget in these three powerful Operating Systems to manage our downloads in a safe way and with total confidence.
Download File in a Basic Way with Wget in Linux
The use of Wget at its basic level consists of the following syntax:
This allows us to download the files natively taking into account the network speed with which we currently have.
Download file without losing downloaded parts with Wget on Linux
To allow a download to be paused either by a network error or by some power failure we can use the -c parameter to allow if something fails as soon as we log in again the download continues. The syntax to use is:
wget -c Link_Adress
Download full web page with Wget on Linux
To download a website entirely, we will use the following:
wget -m http://Adresss
Additional Parameters for Wget -m
With this command, we have downloaded all the components of the web page, but we can add parameters like:
–convert-links: This option allows you to change all the links on the page so that they point to each other.
–page-requisites: It will enable you to download the styles of the page so that your view is excellent without a connection.
–no-parent: Avoid downloading main sites linked to it.
Additional Parameters to use Wget
We can use some parameters using wget:
wget -rIt: allows us to download a web page recursively or using FTP, the syntax is:
wget -r ftp://Adress
wget -i: It offer us the possibility of downloading a list of URLs that we have in a text file, for example, we can have a file called Solvetic.txt so we will use the following:
wget -i LinuxCode.txt
man wget: This option displays a list of all the possibilities to which we have access using wget.
wget -p: This parameter gives us the chance to download a complete web page including extras such as online images, styles, etc.
wget -o: With this parameter, we can create a report about the download we have made, for example:
wget -o linuxcode.txt http://Adress
wget -t (#): By default, wget makes an attempt of 20 connections to start the download, but in case the site is very congested we can use this parameter to increase the number of attempts, for example:
wget -t 30 Adress
As we can see, Wget is a compelling and practical command for everything related to downloads.
Naturally, we have seen how to use wget command on Windows, Mac, and Linux systems, in the latter it is more comfortable because it is already implemented.
Sometimes a command time can be used between the different systems, and we just have to find the right way to take it into account.