If you are using CentOS 7, you may have encountered an error message saying “wget command not found” when trying to use the wget utility. This error can be frustrating, especially if you rely on wget for downloading files and scripts from the internet. Fortunately, there are a few simple solutions to this problem.
Check if wget is installed
The first step in resolving the “wget command not found” error is to check if the wget utility is installed on your CentOS 7 system. You can do this by running the following command in your terminal:
If wget is installed on your system, this command will return the path to the wget executable. If you get no output or an error message, wget is not installed.
If wget is not installed on your CentOS 7 system, you can easily install it using the yum package manager. Run the following command in your terminal:
sudo yum install wget
This will download and install the wget package along with any dependencies.
Update your PATH environment variable
If wget is installed on your CentOS 7 system but you still get the “wget command not found” error, it may be because the wget executable is not in your system’s PATH environment variable. The PATH variable is a list of directories that your system searches for executables when you type a command.
To add the directory containing the wget executable to your PATH environment variable, you can run the following command in your terminal:
This will add the /usr/bin/ directory to your PATH variable, which should contain the wget executable.
Check for any errors
If you have followed the above steps and are still getting the “wget command not found” error, check for any error messages that may be appearing in your terminal. These error messages may provide more information about the problem and help you to identify the cause of the issue.
In conclusion, the “wget command not found” error in CentOS 7 can be caused by a variety of issues, but most often it is due to wget not being installed on your system or not being included in your PATH environment variable. By following the steps outlined above, you should be able to resolve the issue and start using wget to download files and scripts from the internet.