How to Install wget on Linux

January 23, 2021 in Tutorial2 minutes

Learn how to install wget, a powerful command-line downloader, on your Linux system. This tutorial covers installation steps for both yum/dnf-based and apt-based distributions like CentOS, RHEL, Ubuntu, and Debian.

What is wget?

wget is a widely-used, non-interactive command-line utility for downloading files from the web. It supports HTTP, HTTPS, and FTP protocols, as well as retrieval through HTTP proxies. Because it’s non-interactive, it can run in the background, making it perfect for long downloads or automated scripts.

Installing wget on CentOS, RHEL, Oracle Linux, and Fedora

For RPM-based distributions like CentOS, RHEL, Oracle Linux, and Fedora, you can use the yum or dnf package manager to install wget.

Using yum

On CentOS 7 and older versions, you can use the yum command:

sudo yum install wget

Using dnf

On modern RPM-based systems like CentOS 8, Fedora, and RHEL 8, the dnf package manager is preferred:

sudo dnf install wget

After the installation, you can verify that wget is installed correctly by checking its version:

wget --version

This will display the version information for wget, confirming that the installation was successful.

Installing wget on Ubuntu, Debian, and Linux Mint

For Debian-based distributions like Ubuntu and Linux Mint, you can use the apt package manager to install wget.

Using apt-get

On older Debian-based systems, you can use the apt-get command:

sudo apt-get update
sudo apt-get install wget

Using apt

On modern Debian-based systems, the apt command is the recommended approach:

sudo apt update
sudo apt install wget

Just like with the RPM-based systems, you can verify the installation by checking the version:

wget --version

Basic wget Usage

Once wget is installed, you can start downloading files. Here are a few basic examples:

Download a Single File

To download a single file, simply provide the URL:

wget https://example.com/file.zip

Download and Rename a File

You can download a file and save it with a different name using the -O option:

wget -O new-file.zip https://example.com/file.zip

Resume a Partial Download

If a download is interrupted, you can resume it using the -c option:

wget -c https://example.com/large-file.tar.gz

Summary

In this tutorial, you learned how to install wget on various Linux distributions, including CentOS, RHEL, Ubuntu, and Debian. With wget now installed, you can easily download files from the command line, making it a valuable tool for any Linux user.