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.
How to install curl on Debian Linux 9/8
Type the following command to install curl on Debian Linux:
$ sudo apt install curl
$ sudo apt-get install curl
[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 (22.214.171.124-2) ... Setting up curl (7.52.1-5) ...
Once installed you can use it as follows to see the headers:
$ curl -I https://www.google.co.in/
$ curl -I https://sxi.io/
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 http://server1.sxi.io/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: