This article describes how to use the cURL program to transfer files from the command line.
If you need to transfer a file quickly from the command line, the cURL program is often the easiest way to do so. For example, you might need to download a .zip file or .tar.gz file that contains a code library for a project you are working on. With cURL, you can download the file directly to your account, instead of having to use an FTP client to download and transfer the file to your account.
To start cURL, log in to your A2 Hosting account using SSH, and then type the following command:
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
There are many more options available for the cURL program. To learn about them, type the following command: