{"id":4016,"date":"2021-02-03T22:55:02","date_gmt":"2021-02-03T22:55:02","guid":{"rendered":"https:\/\/linuxways.net\/?p=4016"},"modified":"2021-02-03T22:58:39","modified_gmt":"2021-02-03T22:58:39","slug":"how-to-install-and-use-curl-command-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-and-use-curl-command-on-ubuntu-20-04\/","title":{"rendered":"How to Install and Use Curl Command on Ubuntu 20.04"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>Curl is a command-line tool that is used frequently by Linux users. It is a useful utility that can be used to transfer data to or from a remote server.<\/p>\n<p>The curl command supports many protocols: HTTP, HTTPS, SMTP, SCP, FTP, and so on.<\/p>\n<p>This tool is designed for automatic operation, it can be used without user interaction.<\/p>\n<p>This article will explain the way to install the Curl command on your Ubuntu 20.04 machine.<\/p>\n<h2>Installing Curl on Ubuntu 20.04<\/h2>\n<p>Open the terminal and enter the following command:<\/p>\n<pre>$ curl<\/pre>\n<p>If you encounter the output message as follows, it means the curl is not installed on your Ubuntu 20.04 machine.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1536\" height=\"324\" class=\"wp-image-4017\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-16.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-16.png 1536w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-16-300x63.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-16-1024x216.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-16-768x162.png 768w\" sizes=\"auto, (max-width: 1536px) 100vw, 1536px\" \/><\/p>\n<p>You can install the curl by running:<\/p>\n<pre>$ sudo apt update<\/pre>\n<pre>$ sudo apt install curl<\/pre>\n<p>To verify whether the curl is successfully installed, run:<\/p>\n<pre>$ curl --version<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1536\" height=\"466\" class=\"wp-image-4018\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-17.png 1536w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-17-300x91.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-17-1024x311.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-17-768x233.png 768w\" sizes=\"auto, (max-width: 1536px) 100vw, 1536px\" \/><\/p>\n<h2>Getting started with curl<\/h2>\n<p>The most basic way to use the curl command is to run it without any option. The curl will display the source content of the target URL. For example:<\/p>\n<pre>$ curl <a href=\"https:\/\/linuxways.net\/de\/\">https:\/\/linuxways.net<\/a><\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1536\" height=\"878\" class=\"wp-image-4019\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-18.png 1536w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-18-300x171.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-18-1024x585.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-18-768x439.png 768w\" sizes=\"auto, (max-width: 1536px) 100vw, 1536px\" \/><\/p>\n<p>If you want to download files from remote servers with the curl command, let\u2019s use the -o or -O options:<\/p>\n<pre>$ curl -O https:\/\/cdn.kernel.org\/pub\/linux\/kernel\/v5.x\/linux-5.10.11.tar.xz<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1536\" height=\"516\" class=\"wp-image-4020\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-19.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-19.png 1536w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-19-300x101.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-19-1024x344.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-19-768x258.png 768w\" sizes=\"auto, (max-width: 1536px) 100vw, 1536px\" \/><\/p>\n<p>To fetch only the HTTP headers, use the -I option:<\/p>\n<pre>$ curl -I https:\/\/linuxways.net<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1536\" height=\"466\" class=\"wp-image-4021\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-20.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-20.png 1536w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-20-300x91.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-20-1024x311.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/02\/word-image-20-768x233.png 768w\" sizes=\"auto, (max-width: 1536px) 100vw, 1536px\" \/><\/p>\n<p>To transfer files via FTP protocol, you can use the curl command with the -u option and pass the username and password as shown below:<\/p>\n<pre>$ curl -u Ftp-user:Ftp-password ftp:\/\/ftp.domain.com<\/pre>\n<h2>Conclusion<\/h2>\n<p>You\u2019ve successfully installed and tried running some simple examples of the curl command on your Ubuntu 20.04 LTS machine.<\/p>\n<p>If you have any concerns, feel free to leave your comment and let me know. Thank you!<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction Curl is a command-line tool that is used frequently by Linux users. It is a useful utility that can be used to transfer data to or from&hellip;<\/p>","protected":false},"author":23,"featured_media":4022,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[173,100],"class_list":["post-4016","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-curl","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/4016","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\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=4016"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/4016\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/4022"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=4016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=4016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=4016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}