Linux, Web Hosting, and Everything Else in Between
Linux, Web Hosting, and Everything Else in Between

wget – CentOS: How to Install and Use Wget

wget centos

Wget is used to download files via the CLI. In this beginner-friendly tutorial, we’ll show you how to install and use the wget command on CentOS.


For this tutorial, you’ll only need access to a CentOS system. It can be a server (which is most likely) or a desktop with access to the CLI (terminal).

If you need an unmanaged server, you can get one from Vultr or Linode. If you need a managed server, get one from SolaDrive.

This wget tutorial will work on CentOS 8, CentOS 7, Fedora, etc.

If you’re looking for this tutorial, then it means that wget is missing from your CentOS system and you may get the “no such file or directory error”.

How to fix “-bash: /usr/bin/wget: No such file or directory” on CentOS

So, to fix the error you’re getting, you need to install wget on CentOS.

To install it, run the following command:

yum install wget -y

Once that’s done, you can start using wget again.

How to use wget on CentOS – with examples

The basic command syntax looks like this:

wget <options> <url>

You can get a list of available command options and help via this command:

wget -h

So, for example, if you wanted to download our logo, you’d run:


If the URL contains special characters like *, ?, [ and ], you can quote the URL:

wget "[name].zip"

We’ll go through the most common wget options below.

Download a file under a different filename with -O

If you want to download a certain file but save it with a different filename, use the -O option.

The syntax is:

wget -O newFilename.txt

So, here’s an example:

wget -O

Download a file to a specified directory with -P

By default, wget will download the file to the working directory (the directory you’re currently in). If you’d like to save the file to a different directory, you can use the -P option.


wget -P /new/path/to/file


wget -P /var/www/html

This command will save the file to /var/www/html.

Download a file in the background with -b

If it’s a larger file, you can run the wget command with the option -b to download the file in the background while you do something else.


wget -b


wget -b

Download a full website with -m

If you need to download a full website, you can use the option -m to do so. Using the option “-m” is the same as using all these options together “-r -N -l inf –no-remove-listing”.


wget -m

For example, if you’d like to download our website:

wget -m

That’s pretty much it. Those are the most common uses of wget. You can get more information by running wget with the -h option as explained earlier or reading the man page with:

man wget

Leave a comment

Your email address will not be published. Required fields are marked *