How to install curl on Debian Linux 10/9/8

I am a new Debian Linux 10 or 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 10 or 9/8?

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-debian-linux
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. This page shows how to install curl on Debian Linux version 10/9/8.

Installing Curl on Debian

  1. Open the terminal application
  2. Update system, run: sudo apt update && sudo apt upgrade
  3. Install curl on Debian, execute: sudo apt install curl
  4. Test curl

Let us see how to install and use curl on Debian.

How to install curl on Debian Linux 10/9/8

Type the following command to install curl on Debian Linux:
$ sudo apt install curl
OR
$ sudo apt-get 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:
  libcurl3
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 http://mirrors.kernel.org/debian stretch/main amd64 libcurl3 amd64 7.52.1-5 [291 kB]
Get:2 http://mirrors.kernel.org/debian 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 (2.7.6.1-2) ...
Setting up curl (7.52.1-5) ...

Displaying curl version

For verification purpose type:
curl --version
You will see:

curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets

It seems I am using curl version 7.68.0.

Usage

Once installed the curl, you can use it as follows to see the headers for given domain:
$ curl -I https://www.google.co.in/
$ curl -I https://www.cyberciti.biz/

Headers for my blog:

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

We can download a file from a server using curl itself:
curl -o output.file http://server1.cyberciti.biz/foo.bar.txt
You can resume broken download with the curl command as follows:
curl -L -O -C - http://ftp.ussg.iu.edu/linux/centos/latest/isos/file.iso

Getting more help on curl

Type the following man command:
man curl
OR
curl --help

Conclusion

See also:


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • Tony A Feb 2, 2016 @ 12:57

    Thankn you very much. I install it on Debian 8.

  • Abdelalim Jan 2, 2021 @ 14:45

    Thank you for this article.

  • Marian Mar 20, 2021 @ 10:33

    I love helpful pages like this. thank you.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum