How to Fix: bash wget Command Not Found Error

2 min


Here’s how you can fix the “bash: wget command not found” error in Debian, Ubuntu and other distros.

wget command not found error

The famous wget utility is used to download any files from a URL via a terminal. It’s one of the most popular and fastest utilities for Linux terminals.

Being a GNU utility, wget brings some fantastic features to the table. You can implement any project, such as extracting information from the web, downloading files, pausing/resuming, etc.

However, many Linux distros do not come with this utility with default installation. So, when you want to download some files using wget, you get the wget command not found error.

Fixing it is really easy.

Fixing wget command not found

All you need to do is open a terminal prompt and run the following command to install wget.

For Ubuntu, Linux Mint, elementaryOS, Debian and related distros:

sudo apt install wget

Arch Linux:

pacman -S wget

For Fedora (although it includes by default):

sudo dnf install wget

After installation, you can use the wget program. You can also verify whether it’s installed correctly by checking its version.

wget --version

How to use wget

Here are some examples of how you can use the wget program.

The syntax of the command is below:

wget [OPTION]… [URL]…

For example, if I want to download an Ubuntu ISO file, then I can run the following command to download with the direct URL.

wget https://releases.ubuntu.com/22.04.1/ubuntu-22.04.1-desktop-amd64.iso
Sample example of how to use wget
Sample example of how to use wget

Similarly, you can also download using the above command or, by combining several switches as described below. You can also get this via wget --help command.

-t, --tries=NUMBER set number of retries to NUMBER (0 unlimits)
--retry-connrefused retry even if connection is refused
--retry-on-http-error=ERRORS comma-separated list of HTTP errors to retry
-O, --output-document=FILE write documents to FILE
-nc, --no-clobber skip downloads that would download to
existing files (overwriting them)
--no-netrc don't try to obtain credentials from .netrc
-c, --continue resume getting a partially-downloaded file
--start-pos=OFFSET start downloading from zero-based position OFFSET
--progress=TYPE select progress gauge type
--show-progress display the progress bar in any verbosity mode
-N, --timestamping don't re-retrieve files unless newer than
local
--no-if-modified-since don't use conditional if-modified-since get
requests in timestamping mode
--no-use-server-timestamps don't set the local file's timestamp by
the one on the server
-S, --server-response print server response
--spider don't download anything
-T, --timeout=SECONDS set all timeout values to SECONDS
--dns-timeout=SECS set the DNS lookup timeout to SECS
--connect-timeout=SECS set the connect timeout to SECS
--read-timeout=SECS set the read timeout to SECS
-w, --wait=SECONDS wait SECONDS between retrievals
(applies if more then 1 URL is to be retrieved)
--waitretry=SECONDS wait 1..SECONDS between retries of a retrieval
(applies if more then 1 URL is to be retrieved)
--random-wait wait from 0.5WAIT…1.5WAIT secs between retrievals
(applies if more then 1 URL is to be retrieved)

Wrapping Up

I hope this guide helps you to fix the wget error in your Linux distros. The apparent solution is quite simple.

Drop a note below if it helps/or if you have any questions.

Reference


Arindam

Creator of debugpoint.com. All time Linux user and open-source supporter. Connect with me via Telegram, Twitter, LinkedIn, or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x