Top 5 cURL Command Examples

Curl is a computer software project providing a library and command-line tool for transferring data using various protocols. The cURL project produces two products, libcurl and cURL. It was first released in 1997. The name stands for “Client URL”. The original author and lead developer is the Swedish developer Daniel Stenberg. cURL supports various protocols like, DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP.

Every Linux Distribution or Unix-Like operating system nowaday have curl pre-installed because of this wide implementation across platform. This is top 5 Curl Command by Example to try:

1. Stdout a web content

you can print/display website content by URL in terminal with simple curl command:

curl http://www.linux.com

to store the output in a file, you can use simple redirect operator like this example:

curl http://www.linux.com > linux.com.html

2. Download File

We can download file from internet with curl, using -o or -O options. This is the differences between those two commands:

-o , curl will save the file with filename provided in the command line

-O , curl will take the filename from URL

example:

curl -o index.html http://www.linux.com

Download multiple file

to download multiple file, you can use more than one -O options. example:

curl -O url1 -O url2

4. Resume Download

One of the best feature of Curl is Resume Download from the previous URL. To use this feature, you have to use -C – options (beware, there is – sign in the end). Example:

curl -C – -O download.iso http://www.linux.com/download-linux.iso

5. Limit transfer rate

To limit transfer rate when downloading content from internet, use –limit-rate options followed by limit rate in byte per second. Example