cURL Command Examples

cURL command examples

We’ll show you, 5 basic cURL command examples. cURL is very useful command line tool to transfer data from or to a server. cURL supports various protocols like FILE, HTTP, HTTPS, IMAP, IMAPS, LDAP, DICT, LDAPS, TELNET, FTP, FTPS, GOPHER, RTMP, RTSP, SCP, SFTP, POP3, POP3S, SMB, SMBS, SMTP, SMTPS, and TFTP. Check out our article on What is cURL?

What cURL, and what does it do?

curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction. 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 of the social media websites or 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. Check URL with cURL command

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. Save the output of the URL to a file with cURL command

The output of the 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, output will be save to a file named ‘website’ in the current working directory.

3. Download files with cURL command

You can downlaod 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 be also 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. Get HTTP header information from a website with cURL command

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. Access an FTP server with cURL command

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 user’s home directory

You can download a file via FTP

curl --user username:password

and upload a file ot the FTP server

curl -T --user username:password

You can check cURL manual page to see all available cURL options and functionalities

man curl

See Also – Find Large Files in Linux

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. 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 the social networks using the buttons below or simply leave a reply. Thanks.

Tips and Tricks
Connecting via SSH to your server
Tips and Tricks
WordPress 500 Internal Server Error
Tips and Tricks
How to Secure a WordPress Site
  • Toruń


    Author Reply

    You! Rosehosting team are so fabulous, thanks for sharing all these resources that help ppls.

  • DMike92


    Author Reply

    Thanks for this very comprehensive examples. A very good start!

  • Vishal Sanwar

    Really Very great Blog!! It improve my knowledge.

Leave a Reply to DMike92
Cancel Reply