cURL is a command-line tool used to transfer data between servers. It supports various protocols like HTTP, HTTPS, and FTP. Many developers and system administrators rely on cURL for automating data transfers, making it essential for web development and server management tasks.

By default, Ubuntu Server typically includes cURL, but it is often absent from Ubuntu Desktop installations. Desktop users can manually install cURL if needed for tasks such as file transfers or API interactions. This installation process is simple and utilizes Ubuntu’s package management system.

cURL is available through Ubuntu's default repositories. You can install or update it using the apt package manager or Snap, depending on your system and preferences. Both methods ensure quick access to cURL's features for transferring data and interacting with web services.

Steps to install curl on Ubuntu:

  1. Open the terminal.
  2. Update the package list.
    $ sudo apt update
    [sudo] password for user:
    Hit:1 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease
    Hit:2 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease
    Hit:3 http://us.ports.ubuntu.com/ubuntu-ports jammy InRelease
    Reading package lists... Done
  3. Install cURL using apt.
    $ sudo apt install curl
    Reading package lists... Done
    Building dependency tree... Done
    The following NEW packages will be installed:
      curl
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 190 kB of archives.
    After this operation, 436 kB of additional disk space will be used.
    Get:1 http://us.ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 curl arm64 7.81.0-1ubuntu1.4 [190 kB]
    Fetched 190 kB in 2s (84.5 kB/s)
    Selecting previously unselected package curl.
    Preparing to unpack .../curl_7.81.0-1ubuntu1.4_arm64.deb ...
    Unpacking curl (7.81.0-1ubuntu1.4) ...
    Setting up curl (7.81.0-1ubuntu1.4) ...
    Processing triggers for man-db (2.10.2-1) ...
  4. Verify the installation.
    $ curl --version
    curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11
    Protocols: http https ftp ftps
    Features: AsynchDNS HTTPS-proxy IPv6 Largefile SSL TLS-SRP UnixSockets

    If the installation fails, try installing with snap.

  5. Optionally, install or update cURL using snap.
    $ sudo snap install curl
    curl 7.84.0 from Wouter van Bommel (woutervb) installed
  6. Start using cURL to transfer data.
    $ curl https://example.com
    <!doctype html>
    <html>
    <head><title>Example Domain</title></head>
    <body>
    <div>Example content</div>
    </body>
    </html>
    $ curl --help
    Usage: curl [options...] <url>
     -d, --data <data>          HTTP POST data
     -f, --fail                 Fail silently (no output at all) on HTTP errors
     -h, --help <category>      Get help for commands
     -i, --include              Include protocol response headers in the output
     -o, --output <file>        Write to file instead of stdout
     -O, --remote-name          Write output to a file named as the remote file
     -s, --silent               Silent mode
     -T, --upload-file <file>   Transfer local FILE to destination
     -u, --user <user:password> Server user and password
     -A, --user-agent <name>    Send User-Agent <name> to server
     -v, --verbose              Make the operation more talkative
     -V, --version              Show version number and quit
    
    This is not the full help, this menu is stripped into categories.
    Use "--help category" to get an overview of all categories.
    For all options use the manual or "--help all".

This guide is tested on Ubuntu:

Version Code Name
22.04 LTS Jammy Jellyfish
23.10 Mantic Minotaur
24.04 LTS Noble Numbat
Discuss the article:

Comment anonymously. Login not required.