Install and Use cURL on RHEL / CentOS 8

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

Software Engineer | Ethical Hacker & Cybersecurity...

Md Obydullah is a software engineer and full stack developer specialist at Laravel, Django, Vue.js, Node.js, Android, Linux Server, and Ethichal Hacking.