Wget is one of the most important utilities you’ll stumble across when using the Linux terminal. It’s a tool used to download files from the internet which supports HTTP, HTTPS. FTP protocols as well as HTTPS proxies.
The tool has other important features, such as downloading files in the background and resuming previous downloads. However, while running it, some users might experience a ‘command not found’ error.
In this article, we’re taking a look at how to resolve the ‘Bash wget command not found’ error.
Also read: Bash functions explained
What causes the ‘wget command not found’ error and how to fix it?
As you can guess by the error message, you get this error when the Linux terminal can’t interpret what wget means, which translates to the utility not being installed.
To resolve this, first, check what version of wget you have on your machine by using the following command.
This will print out the wget version installed on your machine. Now, if it’s an older version or the command doesn’t run at all, use the following command to install wget on Ubuntu.
sudo apt-get install wget
After this you’ll be able use wget without any issues whatsoever.
Also read: How to change hostname in Ubuntu?
Basic syntax and flags
The basic syntax for using wget is
wget [flag] [file URL]
For example, if you were to download the Linux kernel tar archive, you’d use this command.
You can use different flags around with wget to add further functionality to the command. Some of the most popular flags are as follows:
- -b: Used to download files in the background.
- -c: This flag is used to complete any partial downloads in the currently active directory.
- -O [file name]: This flag is used to save the downloaded file with a different user-specified name.
- -q: Use this flag to turn off output from the tool.
- -P [download path]: The flag lets you save the downloaded file to a directory of your choice.
Also read: Bashrc vs Bash_profile
Someone who writes/edits/shoots/hosts all things tech and when he’s not, streams himself racing virtual cars. You can reach out to Yadullah at [email protected], or follow him on Instagram or Twitter.