{"id":6601,"date":"2021-06-02T16:57:50","date_gmt":"2021-06-02T16:57:50","guid":{"rendered":"https:\/\/linuxways.net\/?p=6601"},"modified":"2021-06-02T16:57:50","modified_gmt":"2021-06-02T16:57:50","slug":"how-to-install-and-use-curl-command-on-centos-8","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/how-to-install-and-use-curl-command-on-centos-8\/","title":{"rendered":"How to Install and Use Curl command on CentOS 8"},"content":{"rendered":"<p>The curl command is used to transfer data to or from a remote server. With the help of the curl command-line tool, you can upload and download data using different network protocols, such as HTTPS, HTTP, SFTP, Telnet, and FTP.<\/p>\n<p>Most of the time, when you are trying to download a file through the curl command, you get an error message saying the curl command is not found. In this situation, you need to install the curl package on your CentOS or any other Linux distribution.<\/p>\n<p>We will give instructions on how to install the curl command on CentOS 8 system in this article. We will show the use of the curl command on CentOS or Linux machines.<\/p>\n<h2><strong>Installation of Curl packages on CentOS 8\u00a0<\/strong><\/h2>\n<p>The curl command can be installed directly from the default CentOS 8 packages repository. Open the terminal from the left sidebar of the \u2018Activities\u2019 section and update the system cache by running the following command:<\/p>\n<pre>$ sudo dnf makecache<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1197\" height=\"548\" class=\"wp-image-6602\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-223.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-223.png 1197w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-223-300x137.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-223-1024x469.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-223-768x352.png 768w\" sizes=\"auto, (max-width: 1197px) 100vw, 1197px\" \/><\/p>\n<p>Once the repository is updated, issue the following command to install the curl packages on your CentOS 8 system. If curl is not installed then, all curl packages will be installed from the CentOS 8 repository.<\/p>\n<pre>$ sudo dnf install curl<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1203\" height=\"36\" class=\"wp-image-6603\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-224.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-224.png 1203w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-224-300x9.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-224-1024x31.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-224-768x23.png 768w\" sizes=\"auto, (max-width: 1203px) 100vw, 1203px\" \/><\/p>\n<p>If curl is already installed on your system then, the following output will display on the terminal.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1098\" height=\"144\" class=\"wp-image-6604\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-225.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-225.png 1098w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-225-300x39.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-225-1024x134.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-225-768x101.png 768w\" sizes=\"auto, (max-width: 1098px) 100vw, 1098px\" \/><\/p>\n<p>Verify the curl installation by typing the following command in the terminal:<\/p>\n<pre>$ curl<\/pre>\n<p>The following output should show on the terminal if curl is installed on your system:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1089\" height=\"60\" class=\"wp-image-6605\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-226.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-226.png 1089w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-226-300x17.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-226-1024x56.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-226-768x42.png 768w\" sizes=\"auto, (max-width: 1089px) 100vw, 1089px\" \/><\/p>\n<p>Display the installed version of the curl command by using the following command:<\/p>\n<pre>$ curl --version<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1101\" height=\"253\" class=\"wp-image-6606\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-227.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-227.png 1101w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-227-300x69.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-227-1024x235.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-227-768x176.png 768w\" sizes=\"auto, (max-width: 1101px) 100vw, 1101px\" \/><\/p>\n<h2><strong>Use of the curl command on Linux system<\/strong><\/h2>\n<p>The curl command is a very useful command-line utility. Using the curl command, you can view the source code of a given URL in a standard output format as follows:<\/p>\n<pre>$ curl <a href=\"https:\/\/linuxways.net\/de\/\">https:\/\/linuxways.net<\/a><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1195\" height=\"755\" class=\"wp-image-6607\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-228.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-228.png 1195w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-228-300x190.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-228-1024x647.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-228-768x485.png 768w\" sizes=\"auto, (max-width: 1195px) 100vw, 1195px\" \/><\/p>\n<p>To get the HTTP header details of the given URL, type the following command:<\/p>\n<pre>$ curl -I <a href=\"https:\/\/linuxways.net\/de\/\">https:\/\/linuxways.net<\/a><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1195\" height=\"498\" class=\"wp-image-6608\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-229.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-229.png 1195w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-229-300x125.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-229-1024x427.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/05\/word-image-229-768x320.png 768w\" sizes=\"auto, (max-width: 1195px) 100vw, 1195px\" \/><\/p>\n<p>Using the curl command, you can download a file from a given URL and use option -o in lowercase to save a file with a name. Use the following command syntax to download a file through the curl command:<\/p>\n<pre>$ curl -o newfile-name.zip <a href=\"http:\/\/domain.com\/filename.zip\">http:\/\/domain.com\/filename.zip<\/a><\/pre>\n<p>Use the uppercase -O to save a file with its original name in your system as follows:<\/p>\n<pre>$ curl -O http:\/\/domain.com\/filename.zip<\/pre>\n<p>Through the curl command, you can also access the password-protected files from the FTP server using the -u option. For this purpose, use the following syntax:<\/p>\n<pre>$ curl -u FTP_user-name:FTP_password ftp:\/\/<a href=\"http:\/\/ftp.domain.com\/filename.zip\">ftp.domain.com\/filename.zip<\/a><\/pre>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>We have seen in this article how to install the Curl command-line tool on CentOS 8 system. Through the curl command, users can download and upload files over the network. We have explored different uses of the curl command on CentOS 8 system. If you need to get more information about this command-line tool then, explore more curl examples on the internet. Give your suggestions through comments. Thanks!<\/p>","protected":false},"excerpt":{"rendered":"<p>The curl command is used to transfer data to or from a remote server. With the help of the curl command-line tool, you can upload and download data&hellip;<\/p>","protected":false},"author":1,"featured_media":6703,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[93,345],"class_list":["post-6601","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-centos-8","tag-curl-command"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/6601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=6601"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/6601\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/6703"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=6601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=6601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=6601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}