cURL can be used in many different and interesting ways. With this tool you can download, upload and manage files, check your email address, or even update your status on some of the social media websites or check the weather outside. This article will introduce you to cURL with five basic command examples.
cURL is very useful command line tool to transfer data from or to a server. cURL supports various protocols like FILE, HTTP, HTTPS, IMAP, IMAPS, LDAP, DICT, LDAPS, TELNET, FTP, FTPS, GOPHER, RTMP, RTSP, SCP, SFTP, POP3, POP3S, SMB, SMBS, SMTP, SMTPS, and TFTP.
Syntax:
1 | curl [options] [URL...] |
URL : The most basic uses of curl is typing the command followed by the URL.
1 | curl http://www.vassox.com |
This should display the content of the URL on the terminal. The URL syntax is protocol dependent and multiple URLs can be written as sets like:
1 | curl http://site.{one, two, three}.com |
URLs with numeric sequence series can be written as:
1 | curl ftp://ftp.example.com/file[1-20].jpeg |
Progress Meter: curl displays a progress meter during use to indicate the transfer rate, amount of data transferred, time left etc.
1 2 | curl -# -o ftp://ftp.example.com/file.zip curl --silent ftp://ftp.example.com/file.zip |
If you like a progress bar instead of meter, you can use the -# option as in the example above, or –silent if you want to disable it completely.