← All cheatsheets

curl Cheatsheet

A practical curl cheatsheet: GET/POST with data and headers, authentication, file downloads, and request debugging — copy-ready with editable placeholders for the URL, method, and payload.

Explain a command

Basics

  • GET a URL
    curl
  • Follow redirects
    curl -L
  • Silent (no progress), still show errors
    curl -sS
  • Download to a named file
    curl -o
  • Download keeping the remote filename
    curl -OL

Methods & data

  • POST JSON
    curl -X POST -H "Content-Type: application/json" -d ''
  • PUT with data
    curl -X PUT -d ''
  • DELETE a resource
    curl -X DELETE
  • POST a form / upload a file
    curl -F =@
  • POST url-encoded fields
    curl -d =

Headers & auth

  • Send a custom header
    curl -H ": "
  • Bearer token auth
    curl -H "Authorization: Bearer "
  • Basic auth
    curl -u :

Debug & inspect

  • Headers only (HEAD request)
    curl -I
  • Verbose (see request + TLS handshake)
    curl -v
  • Print status code and total time
    curl -s -o /dev/null -w '%{http_code} %{time_total}s\n'
  • Skip TLS certificate verificationdestructive
    curl -k

    Disables cert checking — for local/self-signed only, never in production.

  • Override DNS for a host
    curl --resolve ::

18 commands. Copy-ready with editable placeholders — everything runs in your browser, nothing is sent to a server.