curl Cheat Sheet
A reference for curl, making GET and POST requests, sending headers and JSON, handling authentication, following redirects, downloading files, and inspecting responses.
A quick reference to curl, the command-line HTTP client. Replace
URL with your address. Flags can be combined, and most work on every
protocol curl speaks (HTTP, HTTPS, FTP, and more).
Basic requests
| Command | What it does |
|---|---|
curl URL | GET a URL and print the body |
curl -L URL | Follow redirects (3xx) |
curl -i URL | Include the response headers |
curl -s URL | Silent mode (hide the progress meter) |
curl -v URL | Verbose: show request, response, and handshake |
Methods & data
| Command | What it does |
|---|---|
curl -X POST URL | Use a specific HTTP method |
curl -d "a=1&b=2" URL | Send form-encoded POST data |
curl --json '{"k":"v"}' URL | Send JSON (sets method, type, and body) |
curl -d @file.json URL | Send the contents of a file as the body |
Headers & auth
| Command | What it does |
|---|---|
curl -H "X-Api-Key: 123" URL | Add a custom request header |
curl -u user:pass URL | Basic authentication |
curl -H "Authorization: Bearer TOKEN" URL | Bearer token (OAuth / JWT) |
curl -b cookies.txt URL | Send cookies from a file |
curl -c cookies.txt URL | Save response cookies to a file |
Downloading
| Command | What it does |
|---|---|
curl -O URL | Save to a file named after the URL |
curl -o out.zip URL | Save to a file you name |
curl -C - -O URL | Resume an interrupted download |
curl -I URL | Fetch headers only (HEAD request) |
TLS & timing
| Command | What it does |
|---|---|
curl -k URL | Skip TLS certificate verification (insecure) |
curl --cert client.pem URL | Use a client certificate for mTLS |
curl -w "%{http_code}\n" -o /dev/null -s URL | Print just the HTTP status code |
curl --max-time 10 URL | Give up after 10 seconds |
Tip: pair -s (silent) with -S to keep error
messages while hiding the meter, and use -w to print timings like
%{time_total} when you are debugging slow requests.
What this does
A curl cheat sheet covers making GET and POST requests, sending headers and JSON, authentication, redirects, downloads, and inspecting responses.
How to use it
- Browse by section.
- Find the command you need.
- Copy it with one tap.
- Swap in your URL and options.
Example
curl -O https://example.com/file.zip downloads a file keeping its name.
Sources & methodology
Last updated .
Frequently asked questions
How is curl different from wget?
Both fetch URLs, but wget is download-focused and can recurse a whole site, while curl speaks many more protocols and is better for crafting requests with headers, data, and auth.
How do I send a JSON POST request?
Use -X POST with -H "Content-Type: application/json" and pass the JSON body with -d. In modern curl, the --json flag does all three at once.
How do I see the request and response headers?
Add -i to print the response headers, or -v (verbose) to show both the request and the response, including the TLS handshake.
Related tools
Linux Command Cheat Sheet
The essential Linux terminal commands on one page, files and navigation, permissions, processes, networking, and package managers. A quick reference for the bash shell.
Windows CMD Cheat Sheet
A quick reference for the Windows Command Prompt, file and folder commands, networking, disk and system tools, plus handy keyboard shortcuts.
PowerShell Cheat Sheet
A reference for Windows PowerShell, discovering cmdlets, the object pipeline, filtering and formatting, managing files, processes and services, plus variables and flow control.
macOS Terminal Cheat Sheet
A reference for the macOS Terminal, the Mac-only commands (open, pbcopy, mdfind), system and defaults tools, Homebrew, core Unix commands, and keyboard shortcuts.