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 or upload data using various network protocols, such as HTTP, HTTPS, SCP
, SFTP
, and FTP
.
If you get an error message saying curl command not found when trying to download a file with curl, it means that the curl package is not installed on your CentOS machine.
This article provides instructions on how to install and use the curl
command on CentOS 8.
Installing curl on CentOS
Curl package is available in the standard CentOS 8 repositories. To install it run the following command:
sudo dnf install curlOnce the installation is complete, verify it by typing curl in your terminal:
curlThe output should look something like this:
curl: try 'curl --help' or 'curl --manual' for more informationThat’s it! curl has been installed on your CentOS system, and you can start using it.
Using curl
When used without any option, curl prints the source code of the given URL to the standard output:
curl https://example.comTo download a file with curl, use either the -o or -O option, followed by the URLto the file.
The lowercase -o option allows you to specify the name of the saved file:
curl -o linux.tar.xz https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.5.3.tar.xzUppercase -O saves the file with its original filename:
curl -O https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.5.3.tar.xzWhen used with the -I option curl displays the HTTP headers of a given URL:
curl -I https://www.centos.org/HTTP/1.1 200 OK
Date: Thu, 13 Feb 2020 22:01:04 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-8With curl you can also download files from FTP servers that are password protected:
curl -u FTP_USERNAME:FTP_PASSWORD ftp://ftp.example.com/file.tar.gzConclusion
curl is a versatile tool that allows you to send and receive data over the network.
For more information about how to use this tool, check out Curl Command Examples .
If you have any questions or feedback, feel free to leave a comment.
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page