How to install and use Curl on Ubuntu 18.04

Welcome to pay attention to how to use the curl tool to download a file. When you run the curl command, you get an error saying curl command not found. Don't worry, this simply tells you that curl is not installed on your Ubuntu machine.

Curl is a command line tool that allows you to pass data between local and remote servers. With curl, you can use any of the supported protocols to download or upload data. These protocols include HTTP, HTTPS, SCP, SFTP, and FTP.

In this guide, we will show you how to install Curl on Ubuntu 18.04.

1. Install Curl on Ubuntu

Curl is included in the default Ubuntu 18.04 software source. The installation process is straightforward, just enter:

sudo apt install curl

To verify whether curl is installed, type curl in the terminal and press the Enter key Enter:

curl

The output should look like this:

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

that's it! At this point, you have successfully installed curl on your Ubuntu system.

Second, use Curl

If no parameter options are used, Curl will output the resource specified by url on the standard output interface.

For example, the following command will print the source code of the example.com homepage in your terminal window:

curl https://example.com

To download a file using Curl, you can use -o or -O. The lowercase -o allows you to specify the save file name of the file you download:

curl -o linux.tar.xz https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.5.tar.xz

The uppercase -O will save the file with the original file name.

curl -O https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.0.5.tar.xz

Another useful feature of Curl is to get only HTTP headers:

curl -I https://www.ubuntu.com/
HTTP/1.1200 OK
Date: Tue,02 Apr 201920:47:44 GMT
Server: gunicorn/19.9.0
Strict-Transport-Security: max-age=15768000
X-Hostname: juju-prod45-ubuntu-website-machine-15
Content-Type: text/html; charset=utf-8
Age:42
X-Cache: HIT from privet.canonical.com
X-Cache-Lookup: HIT from privet.canonical.com:80
Via:1.1 privet.canonical.com(squid/3.5.12)

Using Curl, you can also download files from a password-protected FTP server:

curl -u FTP_USERNAME:FTP_PASSWORD ftp://ftp.example.com/file.tar.gz

Three, summary##

You have successfully installed Curl on your Ubuntu system. For more information about the most commonly used options of curl, refer to: Curl Command Examples.

Recommended Posts

How to install and use Curl on Ubuntu 18.04
How to install and use Docker on Ubuntu 20.04
How to install and use Composer on Ubuntu 18.04
How to install and use Wine on Ubuntu 18.04
How to install and use Composer on Ubuntu 20.04
How to install and use BaasBox on Ubuntu 14.04
How to install and use PostgreSQL on Ubuntu 16.04
How to install and use Curl on CentOS 8
How to install and use Docker on Ubuntu 16.04
How to install and use MySQL Workbench on Ubuntu 18.04
How to install Pycharm and Ipython on Ubuntu 16.04/18.04
How to install and configure NATS on Ubuntu 16.04
How to install and configure Gogs on Ubuntu 18.04
How to install and use Docker on CentOS 7
How to install and configure Cyberpanel on Ubuntu 18.04
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure ownCloud on Ubuntu 16.04
How to install and configure Ansible on Ubuntu 18.04
How to install and use Composer on CentOS 8
How to install and secure phpMyAdmin on Ubuntu 16.04
How to install and configure Elasticsearch on Ubuntu 16.04
How to install and configure PostGIS on Ubuntu 14.04
How to install and configure VNC on Ubuntu 18.04
How to install and configure Sphinx on Ubuntu 16.04
How to install and configure OrientDB on Ubuntu 14.04
How to install and configure AppScale on Ubuntu 12.04
How to install and configure PostGIS on Ubuntu 14.04
How to install Ruby on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04
How to install Apache on Ubuntu 20.04
How to install R on Ubuntu 20.04
How to install Moodle on Ubuntu 16.04
How to install Solr 5.2.1 on Ubuntu 14.04