How to install curl command on a Ubuntu Linux

last updated in Categories , ,

I am a new Ubuntu Linux user. I switched from Apple MacOS/Macbook and I 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 a Ubuntu Linux version 17.10/16.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 a 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.


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

[sudo] password for vivek: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 152 kB of archives.
After this operation, 375 kB of additional disk space will be used.
Get:1 artful/main amd64 curl amd64 7.55.1-1ubuntu2 [152 kB]
Fetched 152 kB in 2s (52.8 kB/s)
Selecting previously unselected package curl.
(Reading database ... 197772 files and directories currently installed.)
Preparing to unpack .../curl_7.55.1-1ubuntu2_amd64.deb ...
Unpacking curl (7.55.1-1ubuntu2) ...
Setting up curl (7.55.1-1ubuntu2) ...
Processing triggers for man-db ( ..


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

Sample outputs:

HTTP/1.1 200 OK
Date: Fri, 20 Oct 2017 08:56:26 GMT
Content-Type: text/html;charset=utf-8
Connection: keep-alive
Set-Cookie: __cfduid=d7580d53b0be55bab9213e6caf97d55c51508489786; expires=Sat, 20-Oct-18 08:56:26 GMT; path=/;; HttpOnly; Secure
Vary: Accept-Encoding
Cache-Control: public, max-age=14400
Expires: Fri, 20 Oct 2017 12:56:26 GMT
Last-Modified: Sat, 23 Sep 2017 17:37:16 GMT
Strict-Transport-Security: max-age=15552000
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1
X-Whome: l-cbz01
CF-Cache-Status: HIT
Server: cloudflare-nginx
CF-RAY: 3b0ac38e9f678969-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 -
See also:

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.