How To Use curl command in Linux

In this guide, we want to teach you How To Use the 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.

How To Use curl command in Linux

In this guide, you will learn some useful examples of the curl command. It is one of the most useful Linux command tools.

Using curl command in Linux with Examples

First, you can list your curl command version with the following command:

curl --version
curl 7.61.1 (x86_64-redhat-linux-gnu) libcurl/7.61.1 OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.6 libidn2/2.2.0 libpsl/0.20.2 (+libidn2/2.2.0) libssh/0.9.6/openssl/zlib nghttp2/1.33.0
Release-Date: 2018-09-05
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz brotli TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL

Download a file with curl

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 # Save as file.tar.gz
$ curl -o newfile.tar.gz # Save as newfile.tar.gz

Note: If you plan to download multiple files, you can easily use the following structure:

curl -O -O 

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

Use a Proxy

At this point, if you are behind a proxy server listening on port 8080 at, you can use the structure below to download a file:

$ curl -x -U user:password -O
Note: If your proxy doesn’t require any authentication you can skip -U user:password.

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
HTTP/1.1 301 Moved Permanently
Date: Mon, 01 Aug 2022 06:36:16 GMT
Connection: keep-alive
Cache-Control: max-age=3600
Expires: Mon, 01 Aug 2022 07:36:16 GMT
Server: cloudflare

Download Files from an FTP Server

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

Limit 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 -O

There is a lot of usage for this Linux command. For more information, you can visit the curl man page.


At this point, you learn to Use the curl command in Linux with Examples.

Hope you enjoy it.

You may be interested in these articles:

How To Use ifconfig command on Linux

Using Find and Locate commands on Linux

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!