cURL is a well-known utility for transferring data using various protocols, most notably HTTP(S). cURL offers hundreds of CLI parameters. It would be impossible to test or even remember each of them. In this article, you will find some CLI parameters that you may find quite useful in DevOps.

Basics Link to heading

--connect-timeout Link to heading

Sets the connection timeout to defined number of seconds.

curl --connect-timeout 20

-L, --location Link to heading

Directs curl to follow redirect given by 3XX HTTP response code.

curl -L

-o, --output <file> Link to heading

Writes output to specified file. Variables can be used if downloading multiple files:

curl "http://{one,two}" -o "file_#1.txt"

You can also suppress the output:

curl -o /dev/null

And finally, you can also use it multiple times in one command:

curl -o file -o file2

-A, --user-agent <name> Link to heading

Specifies the User-Agent that is sent with the request.

curl -A "Mozilla/5.0"

-s, --silent Link to heading

Silent mode - curl will output nothing (but still download the data - redirection using --output is advised).

--rate-limit <limit> Link to heading

Limit transfer rate (download and upload) to defined limit. Limit is given as bytes per second. The number has to be followed by a suffix, one from (k, M, G, T, P). Every suffix is 1024 based.

curl --limit-rate 100K
curl --limit-rate 10M

-#, --progress-bar Link to heading

Show simple transfer progress bar (made of the # characters) instead of the default meter.

curl -# -O

--keepalive or --no-keepalive Link to heading

Disable or enable keepalive.

curl --no-keepalive
curl --keepalive

DNS Link to heading

--dns-servers <addresses> Link to heading

Specify list of DNS servers (separated with commas if needed) to resolve the domain name with.

Note: this probably won’t work on Debian based system (it still does not work in Ubuntu 22.04). In this case, you have to resolve the domain manually (using dig) and pass its address to curl using the --resolve parameter.

--ipv4 and --ipv6 Link to heading

Resolve names using only IPv4 or IPv6

curl --ipv4
curl --ipv6

TLS & Certificates Link to heading

-k, --insecure Link to heading

Disable certificate verification. Useful for self-signed certificates or if you want to accept an expired certificate.

curl --insecure

--cacert <file> and --capath <path> Link to heading

Specifies file or folder containing PEM-formatted certificate(s) to verify the peer. --cacert can be used only once.


curl --cacert CA-file.txt
curl --capath /local/directory

--crlfile <file> Link to heading

This gives curl the Certificate revocation list in PEM format - curl will check against this list if the peer’s certificate was revoked or not.

curl --crlfile rejects.txt

--ssl-no-revoke Link to heading

Disables certificate revocation checks.

--tls-max <VERSION> Link to heading

Specifies maximum supported TLS version. The minimum version is specified by one of the following parameters: --tlsv1.0, --tlsv1.1, --tlsv1.2, --tlsv1.3

curl --tls-max 1.2
curl --tls-max 1.3 --tlsv1.2

Headers Link to heading

-i, --include Link to heading

Print HTTP response headers at the beginning of the output (before the content)

curl -i

--dump-header <filename> Link to heading

Write received headers to a file.

curl --dump-header store.txt

-H, --header Link to heading

Submit specified header with the request. Can be used multiple times to define more headers.

curl -H "X-First-Name: Joe"

HTTP Methods and Protocols Link to heading

-X, --request <method> Link to heading

You can use --request parameter to specify request method. You can also use specific parameter for each method directly:

-G, --get
-I, --head

You can specify which HTTP protocol version should curl prefer to make the connection.


Further study Link to heading

You can always study all parameters in man pages:

man curl