How to install and use Curl on Ubuntu 20.04

s2 0

curl is a command line utility for transferring data to or from a remote server. With curl, you can download or upload data using any of the supported protocols including HTTP, HTTPS, SCP, SFTP, and FTP.

This article explains the installation Beckon
on Ubuntu 04/20.

Install Curl on Ubuntu

If you get an error message that says curl command not found when trying to download a file with curl, it means that the curl Package is not installed on your Ubuntu computer.

curl is included in the standard Ubuntu 20.04 repositories. Installation is pretty simple:

sudo apt updatesudo apt install curl

Once the installation is complete, verify it by typing curl in your terminal:

curl

The output looks something like this:

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

That’s it! You have successfully installed curl on your Ubuntu machine and you’re ready to use it.

Using curl

When using without option, curl outputs the source code of the specified URL as an argument to standard output.

For example, the following command prints the source of the gnu.org Start page in your terminal window:

curl https://gnu.org

How to load a file with. down curl, use either the -o or -O Options.

The lower case letter -o This option allows you to specify the name of the saved file:

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

When called with capital letters -O, curl saves the file with its original filename:

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

With curl You can also get just the HTTP headers of the given URL:

curl -I https://www.gnu.org/
HTTP/1.1 200 OK
Date: Mon, 29 Jun 2020 07:10:35 GMT
Server: Apache/2.4.7
Content-Location: home.html
Vary: negotiate,accept-language,Accept-Encoding
TCN: choice
Strict-Transport-Security: max-age=63072000
Access-Control-Allow-Origin: (null)
Accept-Ranges: bytes
Cache-Control: max-age=0
Expires: Mon, 29 Jun 2020 07:10:35 GMT
Content-Type: text/html
Content-Language: en

Another common use case of curl is the downloading of files from password-protected FTP servers:

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

diploma

Curl is a versatile tool that allows you to send and receive data over the network. Installing Curl on Ubuntu is a pretty straightforward task.

For more information on using this tool, see Curl Command Examples.

If you have any questions or feedback, please feel free to leave a comment.

Tags: