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.
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.
For RPM-based distributions like CentOS, RHEL, Oracle Linux, and Fedora, you can use the yum
or dnf
package manager to install wget
.
On CentOS 7 and older versions, you can use the yum
command:
sudo yum install wget
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.
For Debian-based distributions like Ubuntu and Linux Mint, you can use the apt
package manager to install wget
.
On older Debian-based systems, you can use the apt-get
command:
sudo apt-get update
sudo apt-get install wget
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
Once wget
is installed, you can start downloading files. Here are a few basic examples:
To download a single file, simply provide the URL:
wget https://example.com/file.zip
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
If a download is interrupted, you can resume it using the -c
option:
wget -c https://example.com/large-file.tar.gz
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.