How to Fix the "wget: command not found" Error

June 7, 2023

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.

Developer using the wget command to fetch a file.

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 usage message in Linux.

The wget: command not found error is displayed if Wget is not installed.

The wget command not found error message.

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
Update apt package lists in Ubuntu.

Use the apt command to install Wget:

sudo apt install wget
Installing wget on Ubuntu.

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 wget version in Ubuntu.

Check the path to the Wget installation directory using the following command:

sudo which wget
Locate wget installation folder in Ubuntu.

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
Installing wget on Fedora and Rocky Linux.

The version of the installed Wget utility is displayed in the terminal.

The installed wget version in Rocky Linux.

The Complete! message indicates that Wget is installed.

The wget installation on Rocky Linux or Fedora is complete.

Use the sudo which wget command to check the installation directory path:

sudo which wget
The wget installation directory in Rocky Linux.

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.

Was this article helpful?
YesNo
Vladimir Kaplarevic
Vladimir is a resident Tech Writer at phoenixNAP. He has more than 7 years of experience in implementing e-commerce and online payment solutions with various global IT services providers. His articles aim to instill a passion for innovative technologies in others by providing practical advice and using an engaging writing style.
Next you should read
Linux Commands All Users Should Know {Ultimate List}
October 4, 2022

This article contains a list of commands all Linux users should know. Whether you're new to Linux or want to learn additional useful commands, the list contains many useful tips and tricks.
Read more
YUM vs. APT: What's the Difference?
November 24, 2022

APT and YUM are two popular package managers. This article shows their similarities and differences and presents examples of basic package management operations.
Read more
How to List, Display, & View all Current Cron Jobs in Linux
March 21, 2014

Cron is used to schedule scripts and commands on Linux systems. Find out where these jobs are stored and list cron jobs running on your computer. Also, use these commands to sort and display tasks scheduled through the cron tool.
Read more
Linux Security Stats, Tools, and Best Practices
March 16, 2023

Maximize your data security with our comprehensive list of 40 Linux security tips and best practices. Implement these tips to minimize risks and ensure the safety of your data.
Read more