Install Curl on Ubuntu 22.04

Install Curl on Ubuntu 22.04

Curl is a command line tool which allows transferring data from or to a server. This tool supports various network protocols such as HTTP, HTTPS, FTP, SFTP, SCP, etc. Curl can be used to automate web tasks, download or upload files, send HTTP requests, for web crawling, etc.

This tutorial explains how to install Curl on Ubuntu 22.04.

Install Curl

Execute the following commands to update the package lists:

sudo apt update

Next, install Curl:

sudo apt install -y curl

When installation is finished, we can check Curl version:

curl --version

Testing Curl

Curl allows sending HTTP requests using GET, POST, PUT and other methods. For example, a GET request can be sent by passing a target URL as first argument:

curl https://httpbin.org/get

In this case, you will get a response in JSON format, which will look similar to the following:

{
  "args": {},
  "headers": {
    "Accept": "*/*",
    "Host": "httpbin.org",
    "User-Agent": "curl/7.81.0",
    "X-Amzn-Trace-Id": "Root=1-6416c45e-47a4828a557d5fca764271d6"
  },
  "origin": "XXX.XXX.XXX.XXX",
  "url": "https://httpbin.org/get"
}

Uninstall Curl

If you wish to completely remove Curl and related dependencies, run the following command:

sudo apt purge --autoremove -y curl

Leave a Comment

Cancel reply

Your email address will not be published.