Introduction
Wget is a command-line utility for retrieving files from the internet. Developers use the wget
command to programmatically download web pages, PDFs, and XML sitemaps and interact with REST API endpoints.
Wget is included as a default package in most Linux distributions. The wget: command not found
error appears when the Wget tool is not installed.
Learn how to install Wget on Ubuntu, Debian, Fedora, or Rocky Linux and fix the wget: command not found
error.
Prerequisites
- Access to a command line/terminal window.
- A user account with sudo or root privileges.
Check if Wget is Installed
To verify the Wget utility is installed, open a terminal and type wget
without entering a URL:
sudo wget
Note: This command is applicable across Linux distributions.
If Wget is present, the system responds with the wget: missing URL
usage message.
The wget: command not found error
is displayed if Wget is not installed.
To resolve the issue, you need to install Wget on your system.
Install Wget
Follow the instructions for the Linux distribution you currently use to install Wget.
Install Wget on Ubuntu/Debian
Before installing Wget on Debian-based Linux distributions such as Ubuntu 22.04 or Debian 11, update the apt package lists using the following command:
sudo apt update
Use the apt command to install Wget:
sudo apt install wget
Once the installation is complete, check the Wget utility version:
sudo wget --version
In this example, the GNU Wget version is 1.21.2.
Check the path to the Wget installation directory using the following command:
sudo which wget
Install wget on Rocky/Fedora
To install Wget on RHEL-based Linux distributions, such as Fedora or Rocky Linux, enter the following command:
sudo dnf install wget -y
The version of the installed Wget utility is displayed in the terminal.
The Complete! message indicates that Wget is installed.
Use the sudo which wget
command to check the installation directory path:
sudo which wget
Conclusion
You have successfully installed Wget and resolved the wget: command not found
error. Wget supports recursive downloads, allowing developers to retrieve initially requested documents and linked documents sequentially, preserving the interconnections within the content.
Explore our starter guide on wget commands with examples and learn how to incorporate Wget in scripts and cron jobs to automate file downloads.