Share your love
7 Easy Examples To Use curl command in Linux

In this guide, we want to teach you How To Use curl command in Linux. cURL, which stands for client URL, is a command line tool that developers use to transfer data to and from a server. At the most fundamental, cURL lets you talk to a server by specifying the location (in the form of a URL) and the data you want to send.
cURL supports several different protocols, including HTTP and HTTPS, and runs on almost every platform. This makes cURL ideal for testing communication from almost any device (as long as it has a command line and network connectivity) from a local server to most edge devices.
You can now follow the guide steps provided by the Orcacore website to Use curl command in Linux.
Table of Contents
Use curl command in Linux with Examples
In this guide, you will learn some Use curl command in Linux with Examples. It is one of the most useful Linux command tools.
1. List Curl Command Linux Version
First, you can list your curl command version with the following command:
curl --version

2. Download a file with curl Command
If you plan to download a file on Linux, you can use curl with “-O” and “-o” options.
Here we will show you the examples of it and how they work:
$ curl -O http://domain.com/file.tar.gz # Save as file.tar.gz
$ curl -o newfile.tar.gz http://domain.com/file.tar.gz # Save as newfile.tar.gz
Note: If you plan to download multiple files, you can easily use the following structure:
curl -O http://site1.com/info.html -O http://site2.com/about.html
3. Resume an Interrupted Download with curl
If your download was interrupted, you can easily resume your download by using the curl command with the “-C –” option:
curl -C - -O http://domain.com/file.tar.gz
4. Use a Proxy with Curl Command
At this point, if you are behind a proxy server listening on a specific port for HTPPs proxies, you can run the command below:
curl -x https://proxy-server:port https://example.com
Using Authentication: If your proxy requires a username and password:
curl -x http://username:password@proxy-server:port http://example.com
5. Query HTTP Headers with the curl command
Another usage of the curl command is to query for HTTP headers.
HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:
), then by its value.
For example:
curl -I orcacore.com

6. Download Files from an FTP Server with curl
If a remote FTP server is expecting connections at ftp://yourftpserver, the following command will download file.tar.gz in the current working directory:
curl -u username:password -O ftp://yourftpserver/file.tar.gz
Note: If the FTP server allows anonymous logins, you can skip -u username:password.
Also, you can easily upload a file to your FTP server. For example:
curl -u username:password -T yourlocalfile.tar.gz ftp://yourftpserver
7. Limit the Download Rate with the curl command
To prevent curl from hosing your bandwidth, you can limit the download rate to 100 KB/s as follows:
curl --limit-rate 100K http://domain.com/file.tar.gz -O
There is a lot of usage for this Linux command. For more information, you can visit the curl man page.
Conclusion
At this point, you have learned to Use curl command in Linux with Examples. You can easily use the curl command for different purposes including query for HTTP headers, using proxies, limiting the download rate, etc.
Hope you enjoy it. You may also interested in these articles:
How To Use ifconfig command on Linux