Curl Command Cheat Sheet
Syntax Debugging & Info
$ curl [parameters] [URL]
COMMAND DESCRIPTION
Display the command usage and lists most common options
$ curl -v http://example.com Verbose Mode
$ curl --help
$ curl -I http://example.com Retrieve Only Headers
Display the command usage and list all available options
$ curl --version Curl Version & Protocols
$ curl --help all
SSL (Secure Socket Layer)
Basic Operations COMMAND DESCRIPTION
COMMAND DESCRIPTION $ curl -k https://example.com Skip SSL Certificate Verification
$ curl http://example.com Fetch a URL $ curl --cert mycert.pem https://example.com Use SSL Certificate
$ curl -O http://example.com/file.zip Download a file
$ curl -L http://example.com Follow redirections Common Options
Option DESCRIPTION
Data Transfer -d, --data <data> HTTP POST data
COMMAND DESCRIPTION -f, --fail Fail fast with no output on HTTP errors
$ curl -d "key1=value1&key2=value2" Post Data -h, --help <category> Get help for commands
http://example.com/post_endpoint
-1, --include Include protocol response headers in the output
$ curl -d '{"key1":"value1", "key2":"value2"}' POST JSON Data
-H "Content-Type: application/json" http://example.com/api --output <file> Write to file instead of stdout
$ curl -F "file=@path_to_file" http://example.com/upload Upload a file -0, --remote-name Write output to a file named as the remote file
--silent Silent mode
Authentication & Headers -T, --upload-file <file Transfer local FILE to destination
COMMAND DESCRIPTION <user:password> Server user and password
$ curl -u username:password HTTP Basic Authentication -A, --user-agent <name> Send User-Agent <name> to server
$ curl -H "Authorization: Bearer YOUR_TOKEN" Add Headers
http://example.com
Other Useful Options
COMMAND DESCRIPTION
$ curl --limit-rate 1M -O http://example.com/file.zip Limit Rate (e.g., 1MB/s)
$ curl -C - -O http://example.com/file.zip Resume Broken Download
$ curl -x http://proxyserver:port http://example.com Use a Proxy
@linuxopsys