Last updated: April 12, 2026
curl Commands Cheatsheet
Quick Answer
curl is the universal command-line tool for making HTTP requests. Use -X for method, -H for headers, -d for body data, -o to save output, and -v for verbose debugging. This covers the 20 most useful flags.
Basic
| Command | Description |
|---|---|
| curl <url> | Make a GET request and print response to stdout curl https://api.example.com/users |
| curl -o <file> <url> | Save response to a file curl -o data.json https://api.example.com/data |
| curl -O <url> | Save with the remote filename |
| curl -s <url> | Silent mode — suppress progress meter |
| curl -v <url> | Verbose — show request/response headers |
Methods
| Command | Description |
|---|---|
| curl -X POST <url> | Specify HTTP method (POST, PUT, DELETE, PATCH) curl -X POST https://api.example.com/users |
| curl -X PUT <url> | Make a PUT request |
| curl -X DELETE <url> | Make a DELETE request |
Headers
| Command | Description |
|---|---|
| curl -H "Header: value" <url> | Set a custom header curl -H "Authorization: Bearer token123" <url> |
| curl -H "Content-Type: application/json" | Set JSON content type |
Data
| Command | Description |
|---|---|
| curl -d '{"key":"val"}' <url> | Send data in request body (POST by default) curl -d '{"name":"Alice"}' -H 'Content-Type: application/json' <url> |
| curl --data-raw <data> <url> | Send raw data without interpretation |
| curl -F "file=@path" <url> | Upload a file as multipart form data curl -F "avatar=@photo.jpg" https://api.example.com/upload |
| curl -d "key=val&key2=val2" <url> | Send form-urlencoded data |
Auth
| Command | Description |
|---|---|
| curl -u user:pass <url> | Basic authentication curl -u admin:secret https://api.example.com/admin |
Options
| Command | Description |
|---|---|
| curl -L <url> | Follow redirects (3xx responses) |
| curl -k <url> | Allow insecure SSL connections (skip cert verification) |
| curl --connect-timeout 5 <url> | Set connection timeout in seconds |
| curl -w "%{http_code}" <url> | Output specific variables (status code, time, etc.) curl -s -o /dev/null -w "%{http_code}" <url> |
| curl -I <url> | Fetch headers only (HEAD request) curl -I https://example.com |
Frequently Asked Questions
More Cheatsheets
Git Commands Cheatsheet
This cheatsheet covers the 40 most essential Git commands grouped by workflow: setup, staging, branc...
Docker Commands Cheatsheet
This cheatsheet covers 35 essential Docker commands for managing containers, images, volumes, and ne...
Linux Commands Cheatsheet
This cheatsheet covers 40 essential Linux/Unix commands for daily development: file navigation, text...
HTTP Status Codes Cheatsheet
HTTP status codes are 3-digit numbers returned by servers. 1xx = informational, 2xx = success, 3xx =...