How to Install and Use wget on CentOS 8

GNU wget is a command-line utility that can be used to download resources from a specified URL. It allows us to download files using different protocols such as HTTP and HTTPS. In this post, you will have a detailed guide on installing wget and using it, along with its different options.

Downloading and Installation of Wget

On most Linux distributions, the wget package is pre-installed, but if for some reason your system does not already have wget, do not worry; we will learn how to install Wget on CentOS 8.

First of all, fire up the terminal and use the wget command to check whether your system has a pre-installed wget package.

$ wget

As you can see in the screenshot above, my system does not have wget pre-installed.

If you do not have a wget, the terminal will give you the option to install it. Just input ‘y’ and press enter, and the installation will start automatically.

Otherwise, if the terminal does not give you the option to install the wget package automatically, you can execute the following commands to get wget on your system:

$ sudo dnf install wget

You may need to replace dnf with yum on older versions of CentOS. You can also use the same command on Ubuntu; just replace the “dnf” with “apt,” and you’re good to go.

Input “y” to start the installation.

Wget has been successfully installed on my CentOS 8 system.

Syntax of using Wget Command

We must first discuss the syntax used by the wget command before we start talking about the different options the wget command gives us and how we can use them.

$ wget [option] [url]

Downloading a file using wget

Now we will use wget to download different files. In the first example, we will use wget in its simplest form.

The following command will download the resource from the specified URL into the current directory:

$ wget https://file-examples-com.github.io/uploads/2017/02/zip_10MB.zip

Download a file under a custom name

Now we will use the -O option along with the wget command. We use this flag to save the downloaded file under a custom name:

$ wget -O example_file.zip https://file-examples-com.github.io/uploads/2017/02/zip_10MB.zip

The command given above will download the resource specified in the URL and save it under the name “example_file.zip.”

You can use the ls command to check the file’s name:

$ ls

Download the file in a specific location

As mentioned above, if we use the simplest form of wget, it will download the resource file in the current directory. The wget utility also gives us the option to download the file in a specific location. We can use the -P flag along with the path to a directory to download the file in that specific directory:

$ wget -P /home/linuxuser/Documents https://file-examples-com.github.io/uploads/2017/02/zip_10MB.zip

We can verify the download by using the ls command:

$ ls /home/linuxuser/Documents

Limit the Download Speed in Wget

We also have the option to limit the download speed while using the wget utility. Use the –limit-rate option to limit the internet speed. You can use k for kilobytes, m for megabytes, and g for gigabytes:

$ wget --limit-rate=500k https://file-examples-com.github.io/uploads/2017/02/zip_10MB.zip

Resume Downloading in Wget

If you have a bad internet connection that continually keeps dropping, you can use the -c option every time to resume the same download. This especially comes in handy when you’re downloading a huge file. You can just resume the download once the internet starts working again instead of starting everything from scratch.

$ wget -c https://file-examples-com.github.io/uploads/2017/02/zip_10MB.zip

Background Downloading using Wget

We also can use the wget command to start a download in the background while we perform other tasks. We can use the -b option to do that:

$ wget -b https://file-examples-com.github.io/uploads/2017/02/zip_10MB.zip

To check the progress, use the tail command:

$ tail -f wget-log

You also need to append the log number in the command given above. You can find the log number from the original wget command, as highlighted in the screenshot above.

Multiple files Downloading using Wget

We can also use the “-i” option and the path to a local or external file containing the list of URLs. The wget command will download resources from all the URLs. Each URL should be written on a separate line in the file:

$ wget -i multiple_files.txt



wget command is handy when it comes to downloading resources from a URL. It provides us with a variety of options that enable us to download in the background, download multiple files, limit downloads, and so on.

In this post, you have learned all about wget, how to install and use the wget command on CentOS 8 Operating system. We also discussed the most common options we can use along with the wget command through practical examples.

About the author

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.