How to install and use wget on CentOS 6, 7, 8 and 9

Endrit Qerreti

Endrit Qerreti

If you try to download something with wget on CentOS 6/7/8/9 you will get the error : bash: wget: command not found or bash: /usr/bin/wget: no such file or directory  and this is because wget is not installed on your system, so to solve this issue you need to install wget first then you can use it to download anything you want.

Follow the steps in this tutorial to learn how to install wget

Step 1 - Login to your server

Login to your server via ssh or your desktop where you want to install wget and then proceed with the installation steps explained below

Step 2 - Open Terminal

Depending where you want to install wget, let's say you want to install it on your server, in this case you need to login to your server via ssh and then simply run the command below.

If you want to install it on your desktop or vm then you need to open terminal and type the commands below.

Step 3 - Install Wget on CentOS 6/7/8

Install Wget on CentOS 6/7

Type the command below to install wget

sudo yum install wget

Install Wget on CentOS 8

The command to install wget is the same, so simply type the following command below again

sudo yum install wget

Once you type the commands above the installation will start, proceed by pressing Y to add the signing Key

Step 4 - Verify wget got installed correctly

Once wget is installed on your system, you must verify it got installed correctly, to do so simply open the terminal and type wget and it should show this output

The output above means wget has been installed and you can use it to download stuff from internet.

Wget basic usage

This is the syntax you must use when downloading stuff or doing something else with wget

wget [option] [url]

Download a file using wget

To download something with wget is pretty easily, type


And the will be downloaded on the same working directory, if you want to change the directory so when you download something to go to your own folder you can do so by typing the cd command

For example: to navigate to Downloads folder you need to run this command, then once you are in the downloads folder run wget from there and the file will get downloaded on Downloads folder

cd Downloads

and it should take you to Downloads folder

Now all you need to do is simply execute the download command, it should look like this

As you see the screenshot above is just an example and the reason why we got the 404 response it's because the doesn't exist this was just an example

Verify if file got downloaded

To verify if the file got downloaded you can do so by using the ls command, so let's say you downloaded something on Downloads directory, to see the files that are located there type


And it should list all the files that are located on Downloads folder

Give a custom name to the file you want to download

If you are downloading let's say something named, but you want this file to be renamed to something else once the download has been completed then you must use the -o option

wget -o

And the will be downloaded as

Download a file in background

This option is useful when you want to download something on your server but don't want to keep being connected to your server.  For example when you are using let's say your friend's computer to connect to your ssh server and download something with wget

wget -b

and it should show you this output

This means the process is running in background even after you close the terminal

Download multiple files

If you have a list of urls that you want to download you can download all of them by using the -i option

wget -i urls.txt

Now pay attention: urls.txt is the text file where the URLs will be located, one url per line

How does urls.txt content look like

So when you run the command above it will download all 3 files at the same time.

Limit the Download Speed

This is another useful option that you can use when you are downloading an large file but you also want to use the internet for other purposes ie: working

So to limit the downloading speed use the option --limit-rate=

Speed parameters that wget supports:

K - Kilobyte

M - Megabyte

G - Gigabyte

wget --limit-rate=200K

For example 200K means a downloading speed of 200KB/s or 1.6Mbps

Resume an Interrupted Download

If your internet connection got disconnected while you were downloading, to resume the same downloading you need to use the -c option

wget -c

Download via FTP

If you need to download something from your FTP server, you need to set username and password before starting to download, in this case you must use



so the command should look like this

wget --ftp-user=myusername --ftp-password=mypassword

and the file will be downloaded from your FTP server which only you have access

Retry Command

Retry command allows you to set a number of retries for wget to retry downloading something.

For example : You were downloading something and the server went down for 10 seconds, to avoid running the same command manually you can use the -t option so wget retries again, and start the download once server comes up online.

wget -t 10

To get the full list of commands on wget type

wget --help

and it should list all the commands that wget supports


Hopefully by now you should know how to Install wget on CentOS 6/7/8 and some of the most useful commands