How to Download Files in Rocky Linux 8 on the Command Line using wget

Rocky Linux wget

It is easy to download a file with a download manager. Through a graphical user interface, users can download many files. But if we talk about the command-line interface or the terminal, most users find it difficult to use this environment. An inexperienced user cannot even download files through a Linux terminal without the assistance of an internet or expert user. Many download managers are used to downloading files from a Linux or Unix environment. In this article, we will explore how we can download files using the wget command in the Rocky Linux Terminal.

Wget is a freely available command-line utility for downloading files. This tool can be installed on Linux, Unix, Windows as well as Mac OS. It is a non-interactive package that allows us to download files in the background without interrupting our work. The program supports downloading files over standard web protocols such as HTTP, FTP, and HTTPS.  Wget offers the following features:

  • Robustness – it can work even if the Internet connection is slow or unstable.
  • Wget continues downloading files when downloading is interrupted due to Internet problems.
  • It is used to download files recursively from the Internet.

There are other command line tools for this purpose available like the curl command.

Check the installed wget version

You can check which version of wget is installed on your system. Use the following command.

$wget --version

Check wget installation

Install Wget command

If wget is not installed, then you will install using dnf command as given below.

$ dnf -y install wget

here, -y option is used for confirmation before installing any utility. Dnf is a tool for command line package management. On other OS like macOS, you can install wget as well with the command “brew install wget” for example when you got the error “-bash: wget: command not found mac”. On Ubuntu with ‘apt install wget”. So install command line tools is not that complicated on any unix like os.

There are the following ways through which we can download files through the wget package.

Download a Single file

When you are downloading a single file, then type wget command and will give the absolute path of file destination.


$ wget https://www.somedomain.tld/somefile.txt

Rename to the download file

You can save the downloaded file with a different name. Type wget -O to rename a file. We have renamed with as shown below.


$ wget -O website URL


$ wget -O /tmp/ https://somedomain.tld/

This command will download the file https://somedomain.tld/ and save it as in the /tmp folder of the local system.

Download the file into a specific directory

You can save the downloaded file into a particular folder or directory. Type the wget command with -P directory name where you want to save the file and type the URL of the file path. As shown below.


$ wget -P <directory path> <website URL>


$ wget -P /tmp https://somedomain.tld/

This will download the file https://somedomain.tld/ into the /tmp folder and save it under the name

Download multiple files at once

You can download multiple files, even from different web protocols like HTTP, HTTPS, and FTP.  Use the wget command with URLs. A practical implementation is given below.


$ wget <HTTP URL> <FTP URL>


$ wget https://somedomain.tld/ https://seconddomain.tld/

Note: you can download any type of file by using the wget command like .txt, .tar, .zip, .png, etc.

Download files in Background

You can immediately download files in the background by using wget -b command. To know about the download file status log will be written in the wget-log file. The output of the command is given below.


$ wget -b <website URL>


$ wget -b https://somedomain.tld/

This will download the file into the current directory. the command prompt will return immediately, so you can continue to work on the shell while the download continues in the background.

Restrict limit to download file

You can restrict the download file limit by using –limit-rate=512k. It’s mean that if you don’t want to download more than 512k or limit, then you will use this command with wget. The implementation is given below.


$ wget --limit-rate=512k <download url>


$ wget --limit-rate=512k https://somedomain.tld/files/

This command will download the file into the current folder, the download rate will get limited to 512Kbit/second.

Wget help

You can find help related to wget by using –help command.


$ wget --help

You can explore more features of the wget command.

Resume interrupted downloads

Sometimes, when we are downloading a file from the internet, at that time error may occur due to internet connection problems. For this purpose, you can resume the download from where the file stops downloading. The following command is used to resume uncompleted downloads.


$ wget -c <website URL>