0% found this document useful (0 votes)
204 views1 page

Ankushagarwal11 Curl Cheat Sheet

- This document provides a cheat sheet for the cURL command line tool, summarizing useful flags and options for tasks like following redirects, sending cookies and headers, authentication, proxies, compression, output, and more. - Key flags covered include -L for following redirects, -b and -c for cookies, -H for headers, -u for authentication, -x for proxies, -o and -O for output/writing to files, and -v for verbose output. - It also lists common exit codes for cURL and explains flags for setting request timeouts, silent mode, and showing errors. The cheat sheet aims to be a quick reference guide for common cURL operations.

Uploaded by

Thiago Monteiro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
204 views1 page

Ankushagarwal11 Curl Cheat Sheet

- This document provides a cheat sheet for the cURL command line tool, summarizing useful flags and options for tasks like following redirects, sending cookies and headers, authentication, proxies, compression, output, and more. - Key flags covered include -L for following redirects, -b and -c for cookies, -H for headers, -u for authentication, -x for proxies, -o and -O for output/writing to files, and -v for verbose output. - It also lists common exit codes for cURL and explains flags for setting request timeouts, silent mode, and showing errors. The cheat sheet aims to be a quick reference guide for common cURL operations.

Uploaded by

Thiago Monteiro
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

cURL cheat sheet Cheat Sheet

by ankushagarwal11 via cheatography.com/18501/cs/1776/

Follow Redirects POST Data Send Header

-L -d <@ filename> -H <header>

-d <data>
Cookies User Agent
Adding an @ reads the data from file.
-b cookiejar Send Cookies using cookiejar -A 'User-Agent-Name'

-c cookiejar Store Cookies in cookiejar HTTP Method


Show Response Header
-b 'n1=v1; n2=v2' -X <Method>
Send raw cookies using -b -i
Specify method to use : POST, HEAD, PUT,
GET, DELETE Prints response headers along with response
Send Binary Data content.

--data-binary @<filename> Output to file


HEAD Request
Does not process the file before sending. -d -o <filename>
sends it in ASCII. -I

Write to file Sends a HEAD request. Only response


Insecure SSL headers are printed.
-O
-k / --insecure
Writes output to file instead of stdout
Verbose output
By default all insecure requests fail. With -k,
insecure requests do not fail. Max operation time -v

Useful to inspect headers


-m <seconds>
Authentication > means data sent by curl
< means data received by curl
-u <username:password> Connect Timeout

--connect-timeout <seconds> Silent mode


Proxy
Specify maximum time allowed to connect to -s
-x <proxy>
remote server
Example : Does not output progress

-x 'http://proxy:2080' Write Out


Show Error
-w <format>
Compression -S
Defines what to display on stdout after a
--compression When used with -s, this shows an error when it
completed and successful operation.
fails.
Curl accepts compression encoding formats : curl -s -w '%{remote_ip} %{time_total} %
gzip, deflate {http_code} \n' -o /dev/null http://ankush.io
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

By ankushagarwal11 Published 28th February, 2014. Sponsored by Readability-Score.com


Last updated 2nd June, 2014. Measure your website readability!
Page 1 of 1. https://readability-score.com

cheatography.com/ankushagarwal11/

You might also like