How to Use Wget to Download Files on Linux

GNU/Linux has many practical uses. You can easily handle all your transactions via the terminal. If you’ve read Linux-related instructions or watched videos, you must have come across the wget command. It is very easy to use and works by taking parameters.

For example, if you know the direct download link of the file you want to download, it is possible to download this file from the console with the help of the wget command without using any extra programs or needing a browser.

4

Here’s everything you need to know about the wget command including some practical examples.

Downloading a Single File

This is one of the most basic uses of the wget command. The purpose here is to download a single file to the system using the known target link. The wget command used for this is:

As it is evident in the image, you can download a file with the wget command and find where it is downloaded withls -l.

MacBook and a Dell laptop running ZorinOS next to each other

Batch Downloading Files

It is possible to download multiple files from links saved in a text document all at once by using the-iparameter with the wget command.

For example, you want to download all the PDFs at a certain address at the same time. For this, you need to save the download links of these PDFs in a text document. You can do this by creating a file namedmy_pdfswith thevim my_pdfscommand and adding the necessary links to it.

Dell monitor showing Windows 10 desktop

Let’s download the PDF formats of the Google Cloud documentation as an example. Save the links to the PDFs in a file and use the following command to download them:

After this step, you can see the downloaded files by running:

firefox logo with yellow warning symbol

Download by Specifying a Custom Location

If you want the file to download to a special location on your system, you need to use the-Pflag with the command:

you could see this in the example below. Likewise, try to download anaircrack-ngfile and this time specify an address. For example, you can create aMyfiledirectory to store the downloaded file.

user using the wget command on a laptop

To download your file to the desired location, you must specify the full path to the directory. You can also run thels -lcommand later to make sure your file is actually where you want it to be.

Download by Specifying a Custom Filename

With thewget -Oparameter, you can name the file you want to download and download it to any location you want. To avoid confusion, create a newoParameterfolder and try to download your aircrack-ng file to this directory by giving it the name you want, in this case,aircrack.

After Wget has finished downloading the file with the name “aircrack” and saving it to the/oParameterdirectory, you can confirm this with thels -lcommand.

In addition, if you want to change the name of the downloaded file without changing its location, it is sufficient to specify the new file name without specifying any location. For example, you canchange the name of the fileto download by using thewget new_name file_linkcommand. Since you do not specify any location, it will automatically land at your present working directory.

Resume Interrupted Downloads With Wget

Failed downloads are one of the most common problems while downloading large files. In such cases, it is possible to resume the download and get the rest of the file.

it’s possible to use the-cparameter with the wget command to re-download an interrupted file. Thus, as a result of usingwget -c download_link, if the file is not completely downloaded, you have the chance to continue from where it left off instead of downloading the file from the beginning. This is very practical, especially for large files.

To understand this better, first create a folder calledResumeon the Desktop. Access this folder with the terminalusing the cd commandand endeavor to download the aircrack file you used in the other examples here. Then interrupt this download with theCtrl + Zkeyboard combination.

As you can see, 19 percent of the file was downloaded, which accounts for 1645946 bytes. Now use the-cparameter in the same way and endeavor to continue the download.

As you can see, the download is complete. Thus, there is no need todelete the fileand download it again from the beginning. This was just a small file for example purposes. But for very large files, you can save your time using Wget.

Limiting Wget Download Speed

If you want, you can cap your download speed for the file you are going to download. For this limitation, you can use the following command:

This command will limit your download speed to 300KB per second.

You can try different speeds by changing the 300K value.

Downloading Files in the Background

You can download a file in the background with the-bparameter. This is useful most of the time when you are busy with other work in the foreground. In addition, if you want to learn the results of the download process, it will be sufficient to examine thewget-logfile located in the same location as the downloaded file.

File Downloads Made Easy With Linux and Wget

Since GNU/Linux is a completely open-source system, it provides an infrastructure that you can customize however you want. You can take advantage of hundreds of thousands of applications and libraries made for Linux. You can handle everything with Wget without the need for any programming knowledge or downloading a program. It is very easy to control the download processes of files that you will download and install on your system with the wget command.

Also, remember that many sources of software other than official websites can endanger your security. That’s why you should always be skeptical of the download links that you use with Wget.

Even your Linux machine is prone to viruses and malware. Unless, you know where you should download your software from.

Obsidian finally feels complete.

Don’t let someone else take over your phone number.

You can’t call this offline, Notion.

One casual AI chat exposed how vulnerable I was.

These are the best free movies I found on Tubi, but there are heaps more for you to search through.

Technology Explained

PC & Mobile