How to install curl command on Ubuntu Linux

last updated in Categories , ,

I am a new Ubuntu Linux user. I switched from Apple MacOS/Macbook and I am trying to run the curl command from a shell script but getting the following error:
bash: curl: command not found
How do I fix this on an Ubuntu Linux version 17.10/19.04/16.04/18.04 LTS?

curl command is a tool to download or transfer files/data from or to a server using FTP, HTTP, HTTPS, SCP, SFTP, SMB and other supported protocols on Linux or Unix-like system.
Installing curl on anfswssssssssssss Ubuntu Linux
One can easily install and use the curl command on a Ubuntu Linux using the apt command or apt-get command to use the curl.

Installing cURL for Ubuntu Linux

The procedure to install cURL on Ubuntu Linux is as follows:

  1. Update your Ubuntu box, run: sudo apt update && sudo apt upgrade
  2. Next, install cURL, execute: sudo apt install curl
  3. Verify install of curl on Ubuntu by running: curl --version

Let us see all commands in details.

Ubuntu install curl command

First update the system and get latest stable curl version for Ubuntu:
$ sudo apt update
$ sudo apt upgrade

Type the following apt command or apt-get command:
$ sudo apt install curl
Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
The following NEW packages will be installed:
  curl libcurl4
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 373 kB of archives.
After this operation, 1,036 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 bionic-updates/main amd64 libcurl4 amd64 7.58.0-2ubuntu3.7 [214 kB]
Get:2 bionic-updates/main amd64 curl amd64 7.58.0-2ubuntu3.7 [159 kB]
Fetched 373 kB in 2s (150 kB/s)
Selecting previously unselected package libcurl4:amd64.
(Reading database ... 164985 files and directories currently installed.)
Preparing to unpack .../libcurl4_7.58.0-2ubuntu3.7_amd64.deb ...
Unpacking libcurl4:amd64 (7.58.0-2ubuntu3.7) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.58.0-2ubuntu3.7_amd64.deb ...
Unpacking curl (7.58.0-2ubuntu3.7) ...
Setting up libcurl4:amd64 (7.58.0-2ubuntu3.7) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up curl (7.58.0-2ubuntu3.7) ...


Run the following command:
$ curl --version
Ubuntu install curl command and verify it


Once installed you can use it as follows to see the headers:
$ curl -I
$ curl -I

Sample outputs:

HTTP/2 200 
date: Mon, 29 Jul 2019 13:13:08 GMT
content-type: text/html; charset=UTF-8
set-cookie: __cfduid=d5292058141c28e3cda2d9501688cff531564405988; expires=Tue, 28-Jul-20 13:13:08 GMT; path=/;; HttpOnly; Secure
vary: Accept-Encoding
strict-transport-security: max-age=15552000
x-whome: l-cbz02
cf-cache-status: HIT
age: 102433
x-content-type-options: nosniff
expect-ct: max-age=604800, report-uri=""
server: cloudflare
cf-ray: 4fdf59334ab9dcb5-MAA

Or download a file from a server using curl itself:
curl -o output.file
You can resume broken download with the curl command as follows:
curl -L -O -C -


This page explained how to install curl command on an Ubuntu Linux system. For more info see curl home page:

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at

Historical Comment Archive

1 comment

    Still, have a question? Get help on our forum!