ToolStack
KO

curl Commands Cheatsheet

curl options for GET/POST, headers, auth, file download, and more

Your data never leaves the browser — all processing is done locally 0 server requests

01

Basic Requests

  • curl https://example.com

    Send a GET request and print the response body

  • curl -o 파일명 URL

    Save the response to a specified filename

  • curl -O URL

    Save the response using the filename from the URL

  • curl -L URL

    Follow redirects (tracks Location headers)

  • curl -s URL

    Run silently without showing progress

  • curl -sS URL

    Suppress progress but still show errors

  • curl -v URL

    Print full request and response including headers (for debugging)

02

HTTP Methods

  • curl -X POST URL

    Send a POST request

  • curl -X PUT URL

    Send a PUT request

  • curl -X PATCH URL

    Send a PATCH request

  • curl -X DELETE URL

    Send a DELETE request

03

Sending Data & Body

  • curl -d "key=value&foo=bar" URL

    POST form data (application/x-www-form-urlencoded)

  • curl -d '{"key":"value"}' -H 'Content-Type: application/json' URL

    POST a JSON body

  • curl -d @파일.json -H "Content-Type: application/json" URL

    Send a file's contents as the request body

  • curl -F "file=@파일경로" URL

    Upload a file as multipart/form-data

04

Headers & Authentication

  • curl -H "Authorization: Bearer 토큰" URL

    Add a Bearer token authorization header

  • curl -H "X-Api-Key: 키값" URL

    Add a custom header

  • curl -u 사용자:비밀번호 URL

    Use HTTP Basic authentication

  • curl -H "Cookie: name=value" URL

    Send a cookie manually

  • curl -b cookies.txt URL

    Read and send cookies from a file

  • curl -c cookies.txt URL

    Save response cookies to a file

05

Inspecting Responses

  • curl -I URL

    Print only response headers (HEAD request)

  • curl -w "%{http_code}" -o /dev/null -s URL

    Print only the HTTP status code

  • curl -w "\ntime: %{time_total}s\n" URL

    Measure and display the total response time

06

TLS & Proxy

  • curl -k URL

    Skip SSL certificate verification (test environments only, never use in production)

  • curl --cacert cert.pem URL

    Use a custom CA certificate

  • curl -x http://proxy:8080 URL

    Route the request through an HTTP proxy

07

Other Useful Options

  • curl -C - -O URL

    Resume an interrupted download

  • curl --limit-rate 1M URL

    Limit download speed to 1 MB/s

  • curl --retry 3 URL

    Retry up to 3 times on failure

  • curl --connect-timeout 10 URL

    Set the connection timeout to 10 seconds

curl: The Swiss Army Knife for HTTP

curl is the most versatile command-line tool for sending HTTP requests. It handles REST API testing, file downloads, authentication headers, response time measurement, and much more. The -v flag prints full request and response headers for quick debugging.

When sending POST requests, always include -H "Content-Type: application/json" with a JSON body — without it, the server may not parse the body correctly.

Use -w to extract specific metrics from responses: time_total for latency measurement, http_code for scripted status checks.

FAQ

How do I pretty-print JSON output from curl?
Pipe the output through a JSON formatter: curl -s URL | python3 -m json.tool or, if jq is installed, curl -s URL | jq . The -s flag suppresses the progress bar so only the JSON appears.
What is the difference between curl and wget?
curl supports a wide range of protocols (HTTP, FTP, SMTP, etc.) and excels at API testing with headers and authentication. wget specializes in recursive downloads and website mirroring. For API calls and custom headers, curl is the better choice.
How do I handle HTTPS certificate errors?
Use -k (--insecure) to skip certificate verification, but never in production — this makes the connection vulnerable to MITM attacks. For self-signed certificates, specify the CA with --cacert cert.pem instead.

Related Tools