How to use cURL

This article describes how to use the cURL program to transfer files from the command line.

When to use cURL

If you need to transfer a file rapidly from the command line, the cURL software is the most convenient option. For instance, you may need to download a .zip or .tar.gz file containing a code library for a project you're working on. Instead of using an FTP software to download and transfer the file to your account, you can use cURL to download the file directly to your account.

How to use cURL

To start cURL, log in to your A2 Hosting account using SSH, and then type the following command:

curl

However, this command by itself does not accomplish much. Let's download a page from the example.com test domain:

curl -O http://example.com/test.html

Curl downloads the page to the current working directory. The -O option instructs cURL to download the output and save it in a file name that has the same name as the source document. In this case, it is test.html. If you open the test.html file on your account, you can see the HTML source page for example.com/test.html.

If you want to download a file and assign it a specific filename, use the -o option. For example, to download the example.com/test.html file to a file on the local account named download.html, type the following command:

curl -o download.html http://example.com/test.html
Was this answer helpful?

Related Articles

How to determine high disk usage locations

This article describes how to determine where your account is using the most disk space....

How to disable e-mail notifications from cron jobs

This article demonstrates how to stop receiving e-mail notifications from cron jobs. By default,...

How to manage the inode count

This article defines an inode count, discusses how to calculate it for your account, and how to...

How to monitor resource usage

This article describes how to monitor resource usage using the top and atop commands. Method 1:...

How to use the shebang

This article defines the shebang and how to utilize it to ensure that your script files execute...