CURL is a command line tool which can download files using a wide range of protocols: HTTP, HTTPS, FTP, FTPS, POP3, IMAP, RTMP, RTSP and many more. It's ideal for automating regular downloads in your own custom scripts.
CURL's basic operations are very simple. Just start by giving it the name of something to download.
By default whatever you're downloading is displayed on the screen, but you can redirect this to a file, or use the Output option to save it somewhere.
curl http://www.example.com/page.html > page.html
curl -o downloadcrew.html http://www.downloadcrew.com
This is just the start, though. Is your resource password=protected? Use this:
You can download several files at once.
curl -o http://www.test.com/file1.txt http://www.test.com/file2.txt
(As we're downloading specific files, the -o option will this time save them locally as their online names, file1.txt and file2.txt).
Maybe you only need part of a file? Here's how to get the first and last 256 bytes of a file.
curl -r 0-255 http://www.domain.com/bigfile.ext
curl -r -256 http://www.domain.com/bigfile.ext
CURL can be smarter that you might expect. You'll often want to download files only if they're newer than a local copy, for example, with a command line this.
curl -z local.html http://www.domain.com/remote.html
Remote.html will be compared to Local.html, and only downloaded if it's more recent.
There are many other options. CURL can upload files, post forms, resume file transfers, set upper or lower transfer speed limits, set a custom referrer or user agent, use cookie authentication and more.
And although it is a command line tool, cURL does a good job of keeping you in touch with whatever it's downloading. A progress bar displays the total download size, the bytes downloaded so far, the average transfer speed, time elapsed, expected completion time and more.
- added CURLOPT_DEFAULT_PROTOCOL
- added new tool option --proto-default
- getinfo: added CURLINFO_ACTIVESOCKET
- turned CURLINFO_* option docs as stand-alone man pages
- curl: point out unnecessary uses of -X in verbose mode