How to Install the wget Command in Debian 12

Debian is the most known Linux distribution that contains many command utilities that help users manage their computers. The wget command is one of these commands that is used to download files from different websites. 

This blog will explain the installation of the wget command in Debian 12 and it will follow the outline:

  1. What is the wget Command in Debian 12
  2. How to Check the Pre-installation of wget Command in Debian 12
  3. What is the Method to Install wget Command in Debian 12
  4. What is the General Syntax of wget Command in Debian 12
  5. What is the wget Command’s Basic Usage in Debian 12
  6. How to Uninstall the wget Command in Debian 12
  7. How to Fix “wget: command not found”

Let’s start the blog by understanding the wget command in Debian 12.

What is the wget Command in Debian 12?

The wget command in Debian 12 is used to download the files from different websites. It supports the following formats of the files:

  • HTTP protocols
  • HTTPS protocols
  • FTP protocols

The wget command is developed by the GNU project and it helps the users to download multiple websites by executing the single command as well. 

How to Check the Pre-Installation of wget Command in Debian 12?

Most of the Linux distributions come with the wget command pre-installed. To verify whether the wget command is already installed on the computer or not, run the command:

$ which wget

If the output displays some path, then it means that the wget command is already installed on the computer. If the output displays, command not found, then install the wget command by following the instructions in this post. 

What is the Method to Install wget Command in Debian 12?

If the wget command is not installed on Debian 12, then users can install it by following the below-mentioned steps. 

Step 1: Launch the terminal

First launch the terminal on Debian 12 by using the shortcut key CTRL+ALT+T as shown:

Step 2: Confirm the Availability of wget Command

To confirm the availability of the wget command in the default repository of Debian 12, execute the command:

$ sudo apt show wget

Step 3: Update the Packages

Now updates all the packages of the default repository of Debian 12 to ensure that the updated version of the wget command should be installed:

$ sudo apt update

Step 4: Install the wget Command

Lastly, use the apt command’s “install” option to install the wget command:

$ sudo apt install wget

Step 5: Check the Installation

Display the installed version of the wget command to verify its installation on the Debian 12:

$ wget --version

The wget command utility has successfully been installed on Debian 12. 

What is the General Syntax of wget Command in Debian 12?

The wget command can be run on the Debian by following the mentioned-below general syntax:

$ sudo wget [Options] [URL]

It is recommended to run the wget command with the root privileges by using the sudo keyword. Then use the wget command with its different options which are not compulsory to use. Finally, type the URL from where the files are supposed to be downloaded. 

What is the wget Command’s Basic Usage in Debian 12?

To understand the usage of the wget command in Debian 12, some of its basic commands are explained. 

Download a File Using the wget Command

To download the file using the wget command, simply run the wget command as shown below:

$ sudo wget https://www.dwsamplefiles.com/?dl_id=559

The file has been downloaded which can be confirmed by listing down the contents of the directory:

$ ls

Download a File to the Specific Path Using the wget Command

If it is supposed to download the file to a specific directory then use the “P” option of the wget command. For example, download the file to the “Downloads” directory by running the below-mentioned command:

$ sudo wget -P /home/itslinuxfoss/Downloads/ https://www.dwsamplefiles.com/?dl_id=559

Now list down the contents of the “Downloads” directory to confirm the execution of the above command:

$ ls /home/itslinuxfoss/Downloads/

Recursive Download Using the wget Command

To download the recursively, use the “r” option of the wget command as shown below:

$ sudo wget -r https://www.dwsamplefiles.com/?dl_id=559

Restriction of the Download Speed Using the wget Command

To download the file at the specific downloading speed, specify the downloading speed with the “–limit-rate=100k” as used in the next command:

$ sudo wget --limit-rate=100k https://www.dwsamplefiles.com/?dl_id=559

Download in the Background Using the wget Command

To download in the background, use the wget command with the “b” option:

$ sudo wget -b https://www.dwsamplefiles.com/?dl_id=559

Continued Download with the Interruption

Use the “c” option of the wget command to resume the download from the point where it is being interrupted:

$ sudo wget -c https://www.dwsamplefiles.com/?dl_id=559

All these commands are used to manage the downloading of the files with the wget command in Debian 12. 

How to Uninstall the wget Command in Debian 12?

To delete the wget command in Debian 12, use the “purge” option of the apt package manager. This option will delete and remove the wget command with all its configuration files:

$ sudo apt purge wget -y

The wget command has been removed and uninstalled from Debian 12. 

How do we fix “wget: command not found”?

If the users experienced the error of the “wget: command not found” with the execution of the wget command as shown below:

This error can easily be resolved by installing the wget command on Debian 12 with the steps explained in this blog

All of this has to do with the setting up the wget command on Debian 12.

Conclusion

To install the wget command on Debian 12, execute the “sudo apt install wget -y” command in the terminal. The wget command is used to download the file or files from different websites using the command-line interface. This post has explained the installation of the wget command in Debian 12 and also its basic usage.