How to Use Wget to Download Files in Linux
GNU/Linux has many practical uses. You can easily manage all your transactions through 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 using the wget command without using additional programs or needing a browser.
Here’s everything you need to know about the wget command, including some practical examples.
Single File Download
This is one of the most basic uses of the wget command. The goal here is to upload a single file to the system using the known target link. The wget command used for this is:
As it is obvious in the image, you can download a file with the wget command and find where it is downloaded with ls -l.
Batch File Download
It is possible to simultaneously download multiple files from links saved in a text document using the -I parameter with the wget command.
For example, you want to download all PDFs to a certain address at once. To do this, you must save the download links of these PDFs in a text document. You can do this by creating a file named my_pdfs with the vim my_pdfs order and adding the necessary links to it.
Let’s download Google Cloud documentation PDF formats as an example. Save the links to the PDFs to a file and use the following command to download them:
wget -i my_pdfs
After this step, you can see the downloaded files by running:
Download by specifying a custom location
If you want the file downloaded to a special location on your system, you must use the -P flag with the command:
wget -P /path/to/dir filelink
You can see it in the example below. Also, try downloading a aircrack-ng file and this time specify an address. For example, you can create a my file directory to store the downloaded file.
wget -P Myfile https:
To upload your file to the desired location, you must specify the full directory path. You can also run the ls -l order later to make sure your file is where you want it to be.
Upload by specifying a custom filename
With the wget -O parameter, you can name the file you want to download and upload it to a location of your choice. To avoid confusion, create a new oParameter folder and try uploading your aircrack-ng file to that directory giving it whatever name you want, in this case, aircrack.
wget -O oParameter/aircrack https:
Once Wget has finished downloading the file with the name “aircrack” and saving it to the /oParameter directory, you can confirm it with the ls -l ordered.
Also, if you want to change the name of the downloaded file without changing its location, just specify the new file name without specifying a location. For example, you can change the name of the file to download using the wget new_name file_link ordered. Since you don’t specify a location, it will automatically land in your current working directory.
wget myfilename https:
Resume Broken Downloads with Wget
Download failures are one of the most common problems when downloading large files. In such cases, it is possible to resume the download and get the rest of the file.
You can use the -vs parameter with the wget command to re-upload an interrupted file. Thus, after using wget -c download_link, if the file is not completely downloaded, you have the option to continue where it left off instead of downloading the file from the beginning. This is very convenient, especially for large files.
To better understand this, first create a folder called resume on the desk. Navigate to this folder with the terminal using the cd command and try downloading the aircrack file you used in the other examples here. Then interrupt this download with the CTRL+Z keyboard combination.
As you can see, 19% of the file has been downloaded, which is 1,645,946 bytes. Now use the -vs setting in the same way and try to continue downloading.
As you can see, the download is complete. Thus, there is no need to delete the file and download it again from the beginning. It was just a small sample file. But for very large files, you can save time by using Wget.
Wget download speed limitation
If you want, you can limit your download speed for the file you are about to download. For this limitation, you can use the following command:
wget --limit-rate 300K https:
This command will limit your download speed to 300 KB 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 -b setting. This is useful most of the time when you are busy with other foreground work. Also, if you want to know the results of the download process, it will be enough to examine the wget-log file located in the same location as the downloaded file.
Simplified file uploads with Linux and Wget
Since GNU/Linux is a completely open-source system, it provides an infrastructure that you can customize as you wish. You can enjoy hundreds of thousands of applications and libraries designed for Linux. You can manage everything with Wget without needing any programming knowledge or downloading a program. It is very easy to control the download processes of the files that you will download and install on your system with the wget command.
Also, keep in mind that many software sources other than official websites can endanger your security. This is why you should always be skeptical about the download links you use with Wget.