How to install curl on Debian Linux 9/8

Posted on in Categories , , last updated October 3, 2017

I am a new Debian Linux 9 user. I switched from Windows server 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 Debian Linux version 9?

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.
One can easily install and use the curl command on a Debian Linux using the apt command or apt-get command to use the curl.


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

[sudo] password for vivek: 
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 libcurl3
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 518 kB of archives.
After this operation, 989 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 stretch/main amd64 libcurl3 amd64 7.52.1-5 [291 kB]
Get:2 stretch/main amd64 curl amd64 7.52.1-5 [227 kB]
Fetched 518 kB in 4s (116 kB/s)
Selecting previously unselected package libcurl3:amd64.
(Reading database ... 240584 files and directories currently installed.)
Preparing to unpack .../libcurl3_7.52.1-5_amd64.deb ...
Unpacking libcurl3:amd64 (7.52.1-5) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.52.1-5_amd64.deb ...
Unpacking curl (7.52.1-5) ...
Setting up libcurl3:amd64 (7.52.1-5) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...
Processing triggers for man-db ( ...
Setting up curl (7.52.1-5) ...


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

Sample outputs:

HTTP/2 200 
server: nginx
date: Tue, 03 Oct 2017 05:24:03 GMT
content-type: text/html;charset=utf-8
vary: Accept-Encoding
cache-control: public,max-age=14400,s-maxage=14400,must-revalidate
expires: Tue, 03 Oct 2017 09:14:57 GMT
etag: d01116f2eda45a43e65b0242ed052e73
last-modified: Sat, 23 Sep 2017 17:37:16 GMT
strict-transport-security: max-age=15768000
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1
x-whome: l-cbz01

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 and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.