Show Menu

cURL cheat sheet Cheat Sheet by

curl is the most powerful command in linux
web     linux     http     curl     transfer

Follow Redirects

-L

Cookies

-b cookiejar
Send Cookies using cookiejar
-c cookiejar
Store Cookies in cookiejar
-b 'n1=v1; n2=v2'
Send raw cookies using -b

Send Binary Data

--data­-binary
@<­fil­ena­me>
Does not process the file before sending. -d sends it in ASCII.

Insecure SSL

-k / --insecure
By default all insecure requests fail. With -k, insecure requests do not fail.

Authen­tic­ation

-u
<us­ern­ame­:pa­ssw­ord>

Proxy

-x <pr­oxy>
Example :
-x 'http:­//p­rox­y:2080'

Compre­ssion

--comp­ression
Curl accepts compre­ssion encoding formats : gzip, deflate
 

POST Data

-d
<@­fil­ena­me>
-d
<da­ta>
Adding an @ reads the data from file.

HTTP Method

-X
<Me­tho­d>
Specify method to use : POST, HEAD, PUT, GET, DELETE

Output to file

-o <fi­len­ame>

Write to file

-O
Writes output to file instead of stdout

Max operation time

-m <se­con­ds>

Connect Timeout

--conn­ect­-ti­meout <se­con­ds>
Specify maximum time allowed to connect to remote server

Write Out

-w
<fo­rma­t>
Defines what to display on stdout after a completed and successful operation.
curl -s -w '%{rem­ote_ip} %{time­_total} %{http­_code} \n' -o /dev/null http:/­/an­kush.io
 

Send Header

-H <he­ade­r>

User Agent

-A 'User-­Age­nt-­Name'

Show Response Header

-i
Prints response headers along with response content.

HEAD Request

-I
Sends a HEAD request. Only response headers are printed.

Verbose output

-v
Useful to inspect headers
> means data sent by curl
< means data received by curl

Silent mode

-s
Does not output progress

Show Error

-S
When used with -s, this shows an error when it fails.

Exit Codes

6
Can't resolve host
7
Couldn't connect to host
28
Operation timeout
55
Failed to send data
56
Failed to receive data

Download the cURL cheat sheet Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/ankushagarwal11_curl-cheat-sheet.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

Like this cheat sheet? Check out our sponsors!

Readable.io is a collection of tools to make your writing better. More readable content means higher conversion rates and better reader engagement. Measure website and document readability, measure keyword density and more!

Click Here To Get Started!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          HTTP Status Codes Cheat Sheet
          rsync Cheat Sheet
          wget Cheat Sheet

          More Cheat Sheets by ankushagarwal11