Getting files from external resources is such a commonplace activity in server management that not many users stop and think about the tools for executing this activity.
In almost all Linux distributions, wget serves as the command-line tool to retrieve files from the internet. In addition, sysadmins use the command for the automated downloading of web pages, PDFs, XML sitemaps, and for interaction with REST API endpoints.
Given its importance, it is no surprise that the wget command comes pre-installed on most Linux distributions.
As such, seeing the wget command not found error is a surprise for many users. This error indicates that the tool is not currently installed on your operating system.
If you encounter this error, we recommend this detailed tutorial. We will discuss how to resolve this error on several popular distributions.
Table Of Contents
- How to Resolve the “wget: command not found” Error in Linux Distributions
How to Resolve the “wget: command not found” Error in Linux Distributions
The process of resolving this error involves two major steps. But before going into the details of these steps, let’s discuss the prerequisites.
- A system running a mainstream Linux distribution.
- A user account with sudo or root privileges.
Step #1: Check if wget Is Installed on Your System
The first step is to verify that wget is available on the system. For this, launch the terminal and run the following command without any arguments or web address:
If wget is available on the system, you’ll see the error message saying wget: missing URL.
If you don’t have the utility on the system, you will see the error message.
Step #2: Install wget on Your System To Resolve the Issue
You can install wget like any other utility through the package manager of your Linux distribution. Let’s discuss the installation process on two popular distribution families.
Install wget on Ubuntu or Debian-based Distributions
Before installing wget on a Debian-based Linux distributions such as Ubuntu 22.04 or Debian 11, ensure that you update the apt package index by executing the following command:
# apt update
Next, use the apt install command to carry out the installation:
# apt install wget
After the installation has finished, print out the version information with the following command:
# wget --version
The next step is to check the installation directory path of wget by executing the following command:
# which wget
Install wget on Rocky/Fedora and RHEL-based Distributions
To install wget on RHEL-based Linux distributions like Fedora or Rocky Linux, run the following command to install wget using the standard dnf package manager:
# dnf install wget -y
Note that near the end of the process, the installation process will display the version of the installed wget utility.
The Complete! message confirms the successful installation.
We recommend confirming the installation directory path with the sudo which wget command:
By successfully installing wget, you have not only fixed the wget: command not found error, but also gained access to wget‘s powerful features, including support for recursive downloads, which enables developers to retrieve initially requested documents and linked documents sequentially while preserving the interconnections within the content.
Unlock Peak Performance with RedSwitches: Explore Our Best-Selling Dedicated Servers Today! Choose RedSwitches for the ultimate in dedicated server solutions. Optimize your online presence now!
We offer the best dedicated server pricing and deliver instant dedicated servers, usually on the same day the order gets approved. Whether you need a dedicated server, a traffic-friendly 10Gbps dedicated server, or a powerful bare metal server, we are your trusted hosting partner.
Q.What is the “wget: command not found” error?
The ‘wget: command not found’ error occurs when the system does not recognize or have wget installed. wget is a CLI utility that retrieves content from web servers.
Q. Is it possible to utilize wget for downloading internet files when the command isn’t installed?
No, you cannot use wget to download files from the internet if the command is not installed. You must install the wget package on your system before you can use it to retrieve files from web servers.
Q. What are the additional options and basic usage of the wget tool?
wget offers a wide range of options for customizing your downloads. You can refer to the documentation or use the wget –help command in your command prompt to see a comprehensive list of options and their descriptions. This will help you make the most of wget’s capabilities.
Q.How can I configure wget’s behavior?
wget offers the ability to customize its behavior via a configuration file, which you can create. wgetrc file in your home directory to set default common options and parameters for wget.
Q.Where can I find the wget executable on my system?
Once wget is installed, you can find the wget executable in the system’s PATH variable. The PATH variable maintains a directory list containing executable file locations, allowing you to execute wget from any directory without needing to specify its full path.
Q. Are there any online communities or resources for wget users and developers?
Yes, an active online community of wget users and developers shares information, tips, and common solutions related to wget usage and troubleshooting. You can join forums or visit websites dedicated to Linux commands to find answers to your questions or engage with the current community.
Q. What do I do if I need to download entire directories or websites using wget?
wget provides recursive download options, allowing you to retrieve entire directories or websites. You can explore wget’s documentation or online resources to learn how to use these fantastic features effectively.
Q. Can I use wget as the root user?
Yes, you can use wget as the root user to perform downloads, but exercise caution. Running wget with root privileges can have security implications, so it’s essential to be mindful of the commands you execute as the root user
Q. How can I upgrade or update the version of wget on my operating system?
To upgrade or update the version of wget on your system, you can check if a newer version is available in your package repository. If so, you can use your package manager, such as apt-get install, to update wget to the latest version.