curl

curl linux command cheatsheet by Thamizhiniyan C S

Introduction

curl is a tool for transferring data from or to a server using URLs. It supports these protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET, TFTP, WS and WSS.


Syntax

curl [options...]


Important Flags

FlagsDescription

-#

Will display a progress meter for you to know how much the download has progressed.(or use --silent flag for a silent crawl)

-o

Saves the file downloaded with the name given following the flag.

-O

Saves the file with the name it was saved on the server.

-C -

This flag can resume your broken download without specifying an offset.

--limit-rate

Limits the download/upload rate to somewhere near the specified range (Units in 100K,100M,100G)

-u

Provides user authentication (Format: -u user:password)

-T

Helps in uploading the file to some server(In our case php-reverse-shell)

-x

If you have to view the page through a PROXY. You can specify the proxy server with this flag. (-x proxy.server.com -u user:password(Authentication for proxy server))

-I

(Caps i) Queries the header and not the webpage.

-A

You can specify user agent to make request to the server

-L

Tells curl to follow redirects

-b

This flag allows you to specify cookies while making a curl request(Cookie should be in the format "NAME1=VALUE1;NAME2=VALUE2")

-d

This flag can be used to POST data to the server(generally used for posting form data).

-X

To specify the HTTP method on the URL. (GET,POST,TRACE,OPTIONS)


Examples

CommandDescription

cURL help menu

Basic GET request

Download file

Skip HTTPS (SSL) certificate validation

Print full HTTP request/response details

Send HEAD request (only prints response headers)

Print response headers and response body

Set User-Agent header

Set HTTP basic authorization credentials

Pass HTTP basic authorization credentials in the URL

Set request header

Pass GET parameters

Send POST request with POST data

Set request cookies

Send POST request with JSON data

APIs

CommandDescription

Read entry

jq

Create (add) entry

Update (modify) entry

Delete entry

Last updated