Ubuntu Tips: cURL

In this post I explain how to install cURL so you may download files from the command line of your Ubuntu computer.

29th December 2010

cURL is a computer software project providing a command-line tool for transferring data using various protocols between networked computers. Since the first release of cURL in 1997, the project has produced two products, cURL and libcurl. I am however for the purposes of this post only interested in the command line tool and to show you how you can use cURL to get files from across the Internet.

Installing cURL

The installation of the cURL is a simple exercise. This task can be completed with one command. You do require the administrator password to complete this modification.

Once you have opened a new Terminal window paste the following command and press enter. You will then be asked to supply the administrator password. Then follow on screen commands.

sudo apt-get install curl

Once the command has finished executing you computer is now ready to use cURL. Below I have a few examples of how you can use cURL from your command line to download files. Enjoy.

Example 1

The following example will retrieve the data at specified address.

curl http://www.matthewwittering.co.uk/blog/ubuntu-tips/curl.htm

Example 2

The example command below will save the data at select content to disk in the current directory with the filename example.html.

curl -o example.html http://www.matthewwittering.co.uk/blog/ubuntu-tips/curl.htm

Example 3

This example is similar to example two, however this time cURL will download the file and save the output to a disk using the filename and the end of the filepath.

curl -O http://www.matthewwittering.co.uk/blog/ubuntu-tips/curl.htm

This work is licenced under a Creative Commons Licence.