Install and Use cURL on RHEL / CentOS 8

Published on February 18, 2020 39 sec read

cURL (pronounced curl) is a tool to transfer data from or to a server. cURL uses network protocol such as HTTP, HTTPS, FTP, FTPS, GOPHER, DICT, TELNET, LDAP or FILE.

Table of Contents

  1. Install cURL
  2. Usage of cURL

Install cURL

cURL is available is on CentOS 8 repository. To install cURL, we have to run this command:

sudo dnf install curl

Now type this command to verify the cURL installation:

curl --version

Usage of cURL

We can see the source code of any website using cURL:

curl http://example.com

To see the HTTP headers of a given URL, we need to run the command like:

curl -I http://example.com

We’re able to download file using cURL. By adding lowercase -o we’re able to save & rename a file. Here’s the example:

curl -o file-rename.zip http://example.com/filename.zip

If we want to keep the same filename, we have to use uppercase -O like this:

curl -O http://example.com/filename.zip

We can also download using FTP password-protected file using cURL:

curl -u FTP_USERNAME:FTP_PASSWORD ftp://ftp.example.com/filename.zip

Author

Hey, I'm Md Obydullah. I build open-source projects and write on Laravel, Linux server, modern JavaScript and more on web development.

Follow

Leave a Reply

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