How to install and use Curl on CentOS 8

curl is a powerful command line tool for transferring data from or to a remote server. With curl, you can download data using various network protocols such as HTTP, HTTPS, SCP, SFTP, and FTP.

If you get the error curl command not found when you try to download a file using curl, it means the curl package is not installed on your CentOS machine.

This article provides instructions for installing and using curl command on CentOS 8.

Installing curl on CentOS

The Curl package is available in the standard CentOS 8 repositories. To install it, run the following command:

sudo dnf install curl

Once the installation is complete, check it out by typing curl in your terminal:


The output should look something like this:

curl: try 'curl --help' or 'curl --manual' for more information

All! curl has been installed on your CentOS system and you can start using it.

With curl

When used without any option, curl prints the source code of the given URL to standard output:


To download a file using curl, use either the -o or -O option followed by the URL of the file.

The lowercase option -o allows you to specify the name of the saved file:

curl -o linux.tar.xz

Uppercase letters -O save the file with the original filename:

curl -O

When used with the -I parameter, curl displays the HTTP headers of the given URL:

curl -I
HTTP/1.1 200 OK
Date: Wed, 19 Feb 2020 07:30:48 GMT
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
Strict-Transport-Security: max-age=31536000
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin                                                                                                                                                    
Last-Modified: Thu, 06 Feb 2020 17:21:08 GMT                                                                                                                                    
ETag: "5421-59deb7fadfdfd"                                                                                                                                                      
Accept-Ranges: bytes                                                                                                                                                            
Content-Length: 21537                                                                                                                                                           
Content-Type: text/html; charset=UTF-8

You can also download files from FTP servers using curl, which are password protected:



curl is a versatile tool that allows you to send and receive data over the network.

For more information on how to use this tool, see 5 Curl Command Examples.

If you have any questions or feedback, do not hesitate to leave comments.