• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install and Use Curl on CentOS 8

Written by Admin, Updated On May 3, 2020
centos, curl, terminal
How to Install and Use Curl on CentOS 8

Curl tool is used for transfer data from or to a server. It can be use to download or upload files with one of the supported protocols including HTTP, HTTPS, SCP, SFTP, and FTP. This article explains how to install curl on CentOS 8 system.

The wget command is alternative way of curl to transfer the files. If you are trying to use curl command and get error message like bash: curl: command not found it means that the curl package is not installed on your CentOS machine.

Step 1 – Install Curl on CentOS#

By default, CentOS repositories includes Curl package. Run the below command to install curl as root or user with sudo privileges:

sudo apt install curl

Step 2 – Verify Installation#

Once the installation is finished, you can verify installation by typing curl in your terminal:

curl

It should show output as below:

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

That’s it! You have successfully installed curl on your CentOS machine, and you can use it.

Step 3 – Using Curl#

If you would like to view source code of any url simply follow url by curl command and hit Enter key:

curl https://google.com/

You can download file using -o or -O flags with curl command. By using lowercase -o option you can specify the name of the saved file as given below:

curl -o go.tar.gz https://dl.google.com/go/go1.14.2.darwin-amd64.tar.gz

Option -O (uppercase) will be used to store file with its original name:

curl -O https://dl.google.com/go/go1.14.2.darwin-amd64.tar.gz

Using curl you can see the headers of any given URL. Use the -I option with curl to display the HTTP headers. For example, if you want to show headers of https://www.google.com/ run below command:

curl -I https://www.google.com/

It will show output as following:

HTTP/1.1 200 OK
Date: Sun, 03 May 2020 11:49:57 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
P3P: CP="This is not a P3P policy! See g.co/p3phelp for more info."
Server: gws
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
Transfer-Encoding: chunked
Alt-Svc: h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Accept-Ranges: none
Vary: Accept-Encoding

To get more help for curl command type man command:

man curl

OR

curl --help

Conclusion#

You successfully learned how to install Curl on CentOS 8 system. For more information about how to use this tool, visit Curl Command Examples.

If you have any questions or suggestion, feel free to leave comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Set or Change Timezone on Ubuntu 20.04
Next Article   How to Install VirtualBox Guest Additions on CentOS 8

Related Posts

  • How to Install SSH Keys on Ubuntu 22.04

    How to Set up SSH Keys on Ubuntu 22.04

    January 7, 2023
  • How to Install Fail2ban on Ubuntu 22.04

    How to Install and Configure Fail2ban on Ubuntu 22.04

    December 5, 2022
  • How to Enable SSH on Ubuntu 22.04

    How to Enable SSH on Ubuntu 22.04

    December 1, 2022

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
  • How to Install MariaDB on Debian 11 Bullseye
    How to Install MariaDB on Debian 11 Bullseye March 8, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook