curl is a command-line tool to transfer data to or from a server, using any of the supported protocols (HTTP, FTP, IMAP, POP3, SCP, SFTP, SMTP, TFTP, TELNET, LDAP, or FILE). curl is powered by Libcurl. This tool is preferred for automation since it is designed to work without user interaction. curl can transfer multiple files at once.
Syntax:
curl [options] [URL...]
URL: The most basic use of curl is typing the command followed by the URL.
curl https://www.hosangit.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:
curl http://site.{one, two, three}.com
URLs with numeric sequence series can be written as:
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.
curl -# -O ftp://ftp.example.com/file.zip curl --silent ftp://ftp.example.com/file.zip
If you like a progress bar instead of a meter, you can use the -# option as in the example above, or –silent if you want to disable it completely.
Options:
-o: saves the downloaded file on the local machine with the name provided in the parameters.
Syntax:
curl -o [file_name] [URL...]
Example:
curl -o hello.zip ftp://speedtest.tele2.net/1MB.zip