Looking for a powerful download program that’s fast,
versatile, and very easy to use? Look no further than Curl. It can download
files via HTTP or FTP with or without authentication, it works over SSL, and it
works without interaction.
Being able to download via FTP without interaction is a
definite boon over scripting other command-line clients. For instance, to
download the latest nmap sources, you could use:
$ curl -O http://download.insecure.org/nmap/dist/nmap-4.00.tar.bz2
This would download the file and save it in the current
Curl has a lot of amazing options, such as being able to set
cookie data for HTTP downloads and “suck” down entire pages and
linked pages. It’s even useful for other things, such as automated tasks. For
instance, to have a custom piece of code on your Web site updated with
information from your local computer, you could build an HTTP request locally
to a specific URL (the custom Web code).
One example of an automated task to set up would be updating
your blog to display the song details that you’re currently listening to on your
desktop computer. Using Curl, you can write a shell script and pass it a few
variables via an HTTP query. In the example below, you would end up with four
transmitted variables: $track, $artist, $album, and $password.
$ curl -s http://mysite.com/songs.php?
Type curl –help for
a brief summary of the various options you can set, and check the Curl man pages for more
detailed information. Using Curl, you can send and receive HTTP, HTTPS, and FTP
traffic with or without authentication on any protocol. In short, Curl is a Swiss-army
knife utility when dealing with HTTP and FTP protocols.
Delivered each Tuesday, TechRepublic’s free Linux NetNote provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!