How to Fix the “wget: command not found” Error

wget is a widely renowned command-line utility in Linux that lets us download files from the web. However, facing the “wget command not found” error can be frustrating when you’re trying to use the wget command to download files in Linux. This error usually occurs if the wget is not installed on your system or your system can’t find it in the PATH. 

In this tutorial, we’ll demonstrate how to fix the wget: command not found error in a Linux environment.

Possible Causes “wget: command not found” Error

The “wget command not found” error usually occurs for two reasons:

  1. wget command is not Installed on your system.
  2. Even if installed, the system may not find the wget if its folder isn’t in the PATH, which is a list of folders the system checks for programs.

Fixing the “wget: command not found” Error

Go through the following fixes to learn how to resolve the “wget: command not found” error by installing wget on your system or configuring the PATH appropriately.

Fix 1: Installing wget on your System

Let’s check the wget version to verify if it is installed on your system or not:

wget --version

If you get results like this, it means wget is not installed on your system yet:

wget version

In that case, you can install wget on your Linux distribution to fix wget: command not found error. To install wget on a Debian-based Linux system, run the below-given command:

sudo apt install wget
install wget

Now check the wget command to verify its installation on your Debian-based Linux system:

wget --version

If you get output something like this, it means you’ve successfully installed wget:

verify wget installation

You can use your distribution’s package manager to install wget on your system. For instance, the below-given command install wget on Fedora/RHEL:

sudo dnf install wget

Similarly, the Arch users can use the Pacman package manager to install wget:

sudo pacman -S wget

Fix 2: Adding wget to System PATH

If wget is installed but you’re still facing the ‘wget: command not found’ error, it means wget is not added to the system’s PATH. Use the which command to check its location and ensure it is in the PATH:

which wget

If the output shows a path to wget, it means wget is already added to the system’s PATH:

check path of wget

However, it retrieves nothing, which means wget is not added to the system’s PATH. In that case, you must execute the following command:

export PATH=$PATH:/path/to/wget

This command temporarily adds wget’s path to your system’s PATH. Be sure to replace /path/to/wget with the actual directory where wget is located. To make this change permanent, add this line to your shell configuration file, such as ~/.bashrc for Bash.

Conclusion

The “wget: command not found” error in Linux can be easily fixed by installing wget on your system or ensuring that its path is correctly added to the system’s PATH. If wget is not installed, using the appropriate package manager for your distribution will resolve the issue. If wget is installed but not recognized, adding its directory to the PATH will allow the system to locate it. In this tutorial, we illustrated both these approaches to quickly resolve the issue and get back to downloading files with wget on your Linux system.

We hope this guide has helped you fix the wget: command not found error. Consider Ultahost’s SSH VPS Hosting which gives you full root access to easily install missing utilities like wget. With complete control over your server, you can fix errors, optimize performance, and ensure smooth operation.

FAQ

Why does the “wget: command not found” error occur?
How do I check if wget is installed on my system?
How can I install wget on my Linux system?
What is the PATH variable in Linux?
What should I do if wget is installed but not found in system?
How can I make the PATH change permanent?
Can I use an alternative of wget for downloading files?

Related Post

Mastering Process Management with Linux ps au

In Linux systems, processes are the backbone of system ...

How to Find a File with Find Command in Linux

The find command in Linux is a powerful and versatile t...

How to Fix Unable to Locate Package in Kali L

Kali Linux is a popular operating system used for secur...

What Is the .bashrc File in Linux?

The .bashrc file is a shell script that runs every time...

How to Use the Linux Head Command

File handling is a day-to-day task of Linux users and a...

Exploring chsh Command in Linux with Examples

The chsh command a utility commonly found in Linux dist...

Leave a Comment