Debian

How to Install wget on Debian 12

Downloading files on Linux systems including Debian 12 is a straightforward task if you are using the GUI version of the operating system. However, it will be difficult if you are using the lite operating system version, because, in that case, you don’t have any choice left besides using the terminal for downloading the files from the Internet. To make this thing happen, wget command is used. It is a lightweight utility that allows Linux users to download files from the Internet at a quick pace and provides several options to download files according to your needs.

In this guide, you will find:

How to Install wget on Debian 12

By default, wget is installed in Debian 12, however, in case you removed this utility accidentally from your system, run the following command to reinstall it:

sudo apt install wget -y

How to Use wget on Debian 12

You can use wget on Debian 12 to perform downloading in different ways, some of which are provided below:

How to Download a File on Debian 12 from wget Command

You can download any file from the internet on Debian 12 right from the terminal using the wget command. You only have to add a URL of a file after the wget command from the following syntax:

wget [URL]

How to Download a File at Specific Location on Debian 12 from wget Command

By default, the wget utility downloads the file in a default user location, however, you can specify the location according to your choice by adding -P flag. You have to add the flag right after the wget command then add the directory location where you want your file to be saved. Then add the URL of a file you want to download.

Here, in the below-given command, I am downloading the Discord deb file in the Downloads directory:

sudo wget -P /home/linux/Downloads/ https://dl.discordapp.net/apps/linux/0.0.39/discord-0.0.39.deb

How to Download a File with a Specific Name on Debian 12 from wget Command

You can also specify the file name besides downloading it with the default name, this can be done by adding -O flag then specify the file name followed by the URL of a file that you want to download.

Here the below-given common downloads the Discord file with the name discord-latest on Debian:

sudo wget -O discord-latest https://dl.discordapp.net/apps/linux/0.0.39/discord-0.0.39.deb

How to Download a File with a Limit Rate on Debian 12 from wget Command

You can also change the limit rate for downloading a file on Debian 12 using the wget command. This can be done by adding the –limit-rate keyword, followed by the limit rate in MBs then add URL to begin downloading the file on Debian:

Here, the following command will download the Discord file on Debian 12 with a limit rate of 1.5 MB:

sudo wget --limit-rate 1.5m https://dl.discordapp.net/apps/linux/0.0.39/discord-0.0.39.deb

How to Download a File After Interruption on Debian 12 from wget Command

You can also download the file from where it is stopped due to an interruption using the wget command. This can be done by adding the -c flag followed by the URL to download that specific file on Debian:

wget -c https://dl.discordapp.net/apps/linux/0.0.39/discord-0.0.39.deb

How to Download Multiple Files on Debian 12 with wget Command

You can also use the wget command on Debian 12 to download multiple files simultaneously from the Internet. You can do this process using the steps given below:

Step 1: First create a text file using nano editor on Debian 12:

nano multiple_files.txt

Step 2: Then add the URLs of the files you want to download by ensuring each line of the text file consists of one URL:

Step 3: Now save the text file using CTRL+X, add Y and press Enter to exit.

Step 4: Then use the wget command with -i flag followed by the file name that includes multiple URLs:

wget -i file_name.txt

This will begin downloading multiple files on your Debian system.

Bonus Method: How to Install wget2 on Debian 12

wget2 is an upgraded version of wget that perform fast downloading and include features like HTTP/2 support, improved compression handling and more. Since it is currently in development mode, it isn’t pre-installed in Linux systems, including Debian 12. However, if you want to try it, you can install wget2 on Debian 12 from the following command:

sudo apt install wget2 -y

Then use the following command to confirm wget2 version on Debian:

wget2 --version

Note: The process to download files using wget2 command is similar to wget command. You only have to replace wget with wget2 in the commands provided in the above section of this guide.

Conclusion

wget is a powerful command-line utility for downloading files from the Internet on terminal. It is preinstalled in Linux systems including Debian 12, however, if uninstalled by mistake, you can install it from the apt install command. In this guide, we have covered in detail the installation and the use of wget command on Debian 12. Following this guide, you will be able to download files with default name, with specific name, redownload the file after interruption and download multiple files simultaneously on Debian 12.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.