cURL Command Examples

cURL command examples

We’ll show you 5 basic cURL command examples, and explain them in detail. cURL is a very useful command line tool used to transfer data from or to a server. cURL supports various protocols, such as FILE, HTTP, HTTPS, IMAP, IMAPS, LDAP, DICT, LDAPS, TELNET, FTP, FTPS, GOPHER, RTMP, RTSP, SCP, SFTP, POP3, POP3S, SMB, SMBS, SMTP, SMTPS, and TFTP. If you’d like to find out more about cURL itself, check out our article: What is cURL?

what is curl

What is cURL, and what does it do?

basic curl command examples

cURL is a tool to transfer data from or to a server, using one of the many supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE). This tool is designed to work without user interaction, making it excellent for automation. It offers proxy support, user authentication, FTP uploading, HTTP posting, SSL connections, cookies, file transfer resume, Metalink, and many other features listed below. cURL can be used in many different and interesting ways. With this tool you can download, upload and manage files, check your email address, or even update your status on some social media websites, and even check the weather outside. In this article will cover five of the most useful and basic uses of the cURL tool on any Linux VPS. For detailed explanation of what is cURL, please visit our dedicated blog post on What is cURL?

1. cURL command 1: Check URL

One of the most common and simplest uses of cURL is typing the command itself, followed by the URL you want to check:


This command will display the content of the URL on your terminal.

2. cURL command 2:  Save the output of the URL to a file

The output of a cURL command can be easily saved to a file by adding the -o option to the command, as shown below:

curl -o website

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
100 41793    0 41793    0     0   275k      0 --:--:-- --:--:-- --:--:--  2.9M

In this example, the output will be saved to a file named ‘website’ in the current working directory. You can save in other directories using the same method as other programs by using forward-slashes.

3. cURL command 3: Download files

You can download files with cURL by adding the -O option to the command. It is used for saving files on the local server with the same names as on the remote server:

curl -O

In this example, the ‘’ zip archive will be downloaded to the current working directory.

You can also download the file with a different name by adding the -o option to cURL:

curl -o

This way the ‘’ archive will be downloaded and saved as ‘’.

cURL can also be used to download multiple files simultaneously, as shown in the example below:

curl -O -O

cURL can be also used to download files securely via SSH using the following command:

curl -u user s

Note that you have to use the full path of the file you want to download.

4. cURL command 4: Get HTTP header information from a website

You can easily get HTTP header information from any website you want by adding the -I option (capital ‘i’) to cURL.

curl -I

HTTP/1.1 200 OK
Date: Sun, 16 Oct 2016 23:37:15 GMT
Server: Apache/2.4.23 (Unix)
X-Powered-By: PHP/5.6.24
Connection: close
Content-Type: text/html; charset=UTF-8

5. cURL command 5: Access an FTP server

To access your FTP server with cURL, use the following command:

curl --user username:password

cURL will connect to the FTP server and list all files and directories in the user’s home directory.

Need a fast and easy fix?
✔ Unlimited Managed Support
✔ Supports Your Software
✔ 2 CPU Cores
✔ 2 GB RAM
✔ 50 GB PCIe4 NVMe Disk
✔ 1854 GeekBench Score
✔ Unmetered Data Transfer

Now just $43 .99


You can download files via FTP, too:

curl --user username:password

and upload a file onto the FTP server:

curl -T filename.extension --user username:password

You can also check the cURL manual page to see all available cURL options and functions:

man curl

This covers most of the basic commands and features that most new users of cURL would seek to use. Of course, the capabilities of cURL are far greater than this guide, with most features intended for experienced users.

curl command example

Of course, if you use one of our Linux VPS Hosting services, you can always contact and ask our expert Linux admins (via chat or ticket) about cURL commands and anything related to cURL. The can show you cRUL command examples and can explain to you the best practices when using cURL commands. They are available 24×7 and will provide information or assistance immediately and they can show you cURL command examples for your needs.

PS. If you liked this post about cURL command examples, please share it with your friends on social networks using the buttons below or simply leave a reply. Thanks.

4 thoughts on “cURL Command Examples”

Leave a Comment