Cyberithub

How to Install curl command on Ubuntu 22.04 LTS (Jammy Jellyfish)

Advertisements

In this article, we will see how to install curl command on Ubuntu 22.04 LTS (Jammy Jellyfish). curl is a free and open source command line utility to transfer data with URLs. curl is so popular that it is almost used by all the IT professionals across the globe one way or the other. It is not just used for transferring the data but also for testing APIs by sending HTTP requests and analyzing responses. It supports number of famous protocols which includes FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS.

curl basically relies on an underlying portable client-side URL transfer library called libcurl for its working. It is very frequently used in bash and shell scripting to accomplish various tasks. curl utility is available to install in almost all the famous platforms. Here we will see the steps to install curl on Ubuntu 22.04 LTS using few simple steps.

 

How to Install curl command on Ubuntu 22.04 LTS (Jammy Jellyfish)

How to Install curl command on Ubuntu 22.04 LTS (Jammy Jellyfish)

Also Read: How to Install pacman package manager on Ubuntu 22.04 LTS 

Step 1: Prerequisites

a) You should have a running Ubuntu 22.04 LTS Server.

b) You should have sudo or root access to run privileged commands.

c) You should have apt or apt-get and dpkg utility available in your Server.

 

Step 2: Update Your Server

It is a good practice to first check and install all the latest available updates from default ubuntu repo by using sudo apt update && sudo apt upgrade command as shown below.

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
Hit:1 https://artifacts.elastic.co/packages/8.x/apt stable InRelease
Hit:2 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu jammy InRelease
Hit:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:5 http://in.archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:6 http://in.archive.ubuntu.com/ubuntu jammy-backports InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
#
# You can verify the status of security fixes using the `pro fix` command.
# E.g., a recent Ruby vulnerability can be checked with: `pro fix USN-6219-1`
# For more detail see: https://ubuntu.com/security/notices/USN-6219-1
#
The following packages have been kept back:
gjs libgjs0g
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.

 

Step 3: Install curl command

In the next step, you can download and install curl utility from default Ubuntu repo by using sudo apt install curl command as shown below. This will download and install the package along with all its dependencies.

cyberithub@ubuntu:~$ sudo apt install curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
curl
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 194 kB of archives.
After this operation, 454 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu jammy-updates/main amd64 curl amd64 7.81.0-1ubuntu1.13 [194 kB]
Fetched 194 kB in 2s (107 kB/s)
Selecting previously unselected package curl.
(Reading database ... 239597 files and directories currently installed.)
Preparing to unpack .../curl_7.81.0-1ubuntu1.13_amd64.deb ...
Unpacking curl (7.81.0-1ubuntu1.13) ...
Setting up curl (7.81.0-1ubuntu1.13) ...
Processing triggers for man-db (2.10.2-1) ...

 

Step 4: Verify Installation

After successful installation, you can verify the installed files path by using dpkg -L curl command as shown below.

cyberithub@ubuntu:~$ dpkg -L curl
/.
/usr
/usr/bin
/usr/bin/curl
/usr/share
/usr/share/doc
/usr/share/doc/curl
/usr/share/doc/curl/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/curl.1.gz
/usr/share/zsh
/usr/share/zsh/vendor-completions
/usr/share/zsh/vendor-completions/_curl
/usr/share/doc/curl/NEWS.Debian.gz
/usr/share/doc/curl/changelog.Debian.gz

 

Step 5: Check Version

You can also check the current installed version by using curl --version command as shown below.

cyberithub@ubuntu:~$ curl --version
curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.16
Release-Date: 2022-01-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd

 

Step 6: Using curl

Now that curl is installed in the system, it is time to use it to transfer data with URL. Here we are going to download flutter SDK from official website by using below curl command where -o option is used for specifying the output filename.

cyberithub@ubuntu:~$ curl -o flutter_linux_3.13.0-stable.tar.xz https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.13.0-stable.tar.xz
% Total    % Received % Xferd  Average Speed   Time   Time      Time   Current
                               Dload   Upload  Total  Spent     Left   Speed
100  537M 100    537M 0     0  7487k       0  0:01:13 0:01:13 --:--:-- 7605k

 

Step 7: Check all the Available Options

You can check all the options available with curl utility by using curl --help command as shown below.

cyberithub@ubuntu:~$ 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".

 

Step 8: Uninstall curl command

Once you are done using curl tool, you can choose to uninstall it from your system by using sudo apt remove curl command as shown below.

cyberithub@ubuntu:~$ sudo apt remove curl
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
curl
0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
After this operation, 454 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 239603 files and directories currently installed.)
Removing curl (7.81.0-1ubuntu1.13) ...
Processing triggers for man-db (2.10.2-1) ...

If you are looking to remove curl utility along with all its dependencies then you need to run sudo apt remove curl --auto-remove command as shown below.

cyberithub@ubuntu:~$ sudo apt remove curl --auto-remove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
curl
0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
After this operation, 454 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 239603 files and directories currently installed.)
Removing curl (7.81.0-1ubuntu1.13) ...
Processing triggers for man-db (2.10.2-1) ...

If you are also looking to remove all the curl related configuration files along with the package itself then you need to use sudo apt purge curl --auto-remove command as shown below.

cyberithub@ubuntu:~$ sudo apt purge curl --auto-remove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
curl*
0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
After this operation, 454 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 239603 files and directories currently installed.)
Removing curl (7.81.0-1ubuntu1.13) ...
Processing triggers for man-db (2.10.2-1) ...

Leave a Comment