The Wget command is a very helpful command in the Linux environment that allows us to download our desired files from the Internet. In most of the Linux distributions, this command comes pre-installed. In this article, we will be discussing the methods of using the Wget command for downloading files in Linux Mint 21.
Using Wget to Download Files in Linux Mint 21:
The following two methods will show you how you can download a single as well as multiple files by using Wget in Linux Mint 21.
Method # 1: Downloading a Single File with Wget in Linux Mint 21
If you only wish to download a single file with Wget in Linux Mint 21, then you have to proceed with the steps shown below:
Step # 1: Download a Single File with Wget
First, you need to run the following command:
$ wget https://file-examples.com/wp-content/uploads/2017/02/file-sample_100kB.doc
Here, you only need to know the correct link to the file to be downloaded.
When you run this command, the specified file will start downloading in your current working directory, and after some time, you will notice the termination of this command, as shown in the following image:
Step # 2: Verify the Download
Now, we will verify if the specified file has been downloaded successfully or not. For that, we will execute the command stated below:
$ ls –l
The downloaded file has been highlighted in the following image:
Method # 2: Downloading Multiple Files at Once with Wget in Linux Mint 21
At times, you might want to download multiple files at once while using the Wget command in Linux Mint 21. For that, you will have to perform an additional step as explained in the procedure below:
Step # 1: Save the Links of All the Files to be downloaded to another File:
First, you need to create a file to hold the links to all the files to be downloaded. For that, you can run the following command:
$ sudo nano myfiles
This command will create a file named “myfiles” in the current working directory and will also open this file with the Nano editor.
Once this file opens with the Nano editor, you need to copy and paste the links of all the files to be downloaded into this file. We have pasted the links to three different files into this file as shown in the image below. After that, you can simply press Ctrl+X to save this file and exit the editor.
Step # 2: Download all the Files with Wget
Now, to download all of these files at once with Wget, we will run the following command:
$ wget –i myfiles
This command will instantly start downloading all the files by visiting the links mentioned in the “myfiles” file. Once all the files have been downloaded, the output shown below will be rendered on the terminal:
Step # 3: Verify the Download
To check whether all the files have been successfully downloaded or not, we will run the following command:
$ ls –l
The highlighted portion of this output verifies that all the specified files have been successfully downloaded to our Linux Mint 21 system.
This article discussed the usage of the Wget command in Linux Mint 21 for downloading files. In this regard, we shared with you two different methods with which you can download a single as well as multiple files on your system by making use of this command. As per your requirements, you can pick either of these methods and get your work done.