How to Install and Use Curl on CentOS 8

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

Install 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

After installation is complete, verify this by typing curl in your terminal:


After that, the output will appear:

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

Curl has been successfully installed on your server and you can use it!

Operations Using Curl

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


To download a file using curl, use the -o or -O option and then the file URL. The -o lowercase parameter allows you to specify the file name to save:

curl -o linux.tar.xz

When used with the -I option, curl displays the HTTP headers for this 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

With curl, you can also upload files from password protected FTP servers:


Was this article helpful?

Related Articles

Leave A Comment?