How To Install curl on Ubuntu 22.04

In this tutorial we learn how to install curl on Ubuntu 22.04. curl is command line tool for transferring data with URL syntax

Introduction

In this tutorial we learn how to install curl on Ubuntu 22.04.

What is curl

curl is:

curl is a command line tool for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP.

curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos…), file transfer resume, proxy tunneling and a busload of other useful tricks.

There are three methods to install curl on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install curl Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install curl using apt-get by running the following command:

sudo apt-get -y install curl

Install curl Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install curl using apt by running the following command:

sudo apt -y install curl

Install curl Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install curl using aptitude by running the following command:

sudo aptitude -y install curl

How To Uninstall curl on Ubuntu 22.04

To uninstall only the curl package we can use the following command:

sudo apt-get remove curl

Uninstall curl And Its Dependencies

To uninstall curl and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove curl

Remove curl Configurations and Data

To remove curl configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge curl

Remove curl configuration, data, and all of its dependencies

We can use the following command to remove curl configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge curl

References

Summary

In this tutorial we learn how to install curl package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.