Curl command is used to transfer files to and from a server, it supports a number of protocols like HTTP, HTTPS, FTP, FTPS, IMAP, IMAPS, DICT, FILE, GOPHER, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP etc.

Curl also supports a lot of features like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer pause & resume, etc. There are around 120 different options that can be used with curl & in this tutorial, we are going to discuss some important Curl commands with examples.

(Recommended Read: Useful Linux Commands that you should know)

(Also Read: Commands to check System & Hardware Information)


Curl command with examples

Download or visit a single URL

To download a file using CURL from http or ftp or any other protocol, use the following command

$ curl

If curl can't identify the protocol being used, it will switch to http. We can also store the output of the command to a file with '-o' option or can also redirect using '>',

$ curl -o test.html , or,

$ curl > test.html


Download multiple files

To download two or more files with curl in a single command, we will use '-O' option. Complete command is,

$ curl -O -O


Using ftp with curl

To browse a ftp server, use the following command,

$ curl --user username:password

To download a file from the ftp server, use the following command,

$ curl --user username:password -o test.tar.gz

To upload a file to the ftp server using th curl command, use the following,

$ curl -T ftp:/ --user username:password


Resume a paused download

We can also pause and resume a download with curl command. To do this, we will first start the download ,

$ curl -O

than pause the download using 'ctrl+C' & to resume the download, use the following command,

$ curl -C - -O

here, '-C' option is used to resume the download.


Sending an email

Though you might not be using it any time soon, but none the less we can use curl command to send email. Complete command for sending an email is,

$ curl --url "smtps://" --ssl-reqd --mail-from "" --mail-rcpt "" --upload-file mailcontent.txt --user "" --insecure


Limit download rate

To limit the rate at which a file is downloaded, in order to avoid network choking or for some other reason, use the curl command with '--limit-rate' option,

$ curl --limit-rate 200k -O


Show response headers

To only see the response header of a URL & not the complete content , we can use option '-I' with curl command,

$ curl -I

This will only show the headers like http protocol, Cache-contorol headers, content-type etc of the mentioned url.


Using http authentication

We can also use curl to open a web url that has http authentication enabled with curl using '-u ' option. Complete command is,

$ curl -u user:passwd


Using a proxy

To use a proxy server when visiting an URL or downloading, use '-x' option with curl,

$ curl -x


Verifying Ssl certificate

To verify a SSL certificate of an URL, use the following command,

$ curl --cacert ltchlb.crt


Ignoring SSL certificate

To ignore the SSL certificate for an URL, we can use '-k' option with curl command,

$ curl -k

With this we end our tutorial on learning CURL command with examples. Please leave your valuable feedback & questions in the comment box below.


If you think we have helped you or just want to support us, please consider these :-

Connect to us: Facebook | Twitter | Google Plus

Donate us some of you hard earned money: [paypal-donation]

Linux TechLab is thankful for your continued support.