Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Curl command reference with options sorted by category for easier usage than that man page.
==========================================
CURL COMMAND
==========================================
Format curl [options] [URL...]
Quick Ref:
curl -X POST http://example.com/ <= Method option and URL (Options come before or after URL)
-H "Authorization: <data>" <= Add HTTP Header (like Authorization)
-H "Authorization: Token token=a47a8e54b11c4de5a4a351734c80a14a"
-A "user-agent-string" <= Specify an Agent
-b "name=data" <= Send cookies
-u "user:password" <= Basic HTTP Auth (or "<apikey>:")
-H "Range: page=1" <= Range header for pagination
-H "Accept: application/vnd.mycompany.api.v3+json"
<= Specify API version and JSON as Content-Type
-d "name=value" <= Multiple POST parameters
--data-urlencode "name=value" <= SAFER: URL-Encodes the POST parameter (with special characters)
converts to POST. To UrlEncode GET query, use the -G options
-F "name=@/path/file" <= Multiple File Uploads
-F "webpage=@index.html;filename=index.html;type=text/html"
-G <= Make a GET request (in combo with --data-urlencode)
-I <= Make HEAD request only
-i <= Print response headers
-v <= Verbose, see request and response
-sS <= Do not print status bar (in scripts)
-k, --insecure <= Allow Self-Signed and other insecure Certificated for https
OPERATIONS
-# --progress-bar
--environment
-f --fail (fail silently)
-g --globoff
-K --config <config file>
--libcurl <file>
-n --netrc (.netrc password file)
--netrc-file <alt-filename>
--netrc-optional
--proto <protocols>
--proto-redir <protocols>
-q (skip .curlrc)
--retry <num>
--retry-delay <seconds>
--retry-max-time <seconds>
-s --silent
-S --show-error
-y --speed-time <time>
-Y --speed-limit <speed>
-h --help
-M --manual
-V --version
.
NETWORK
-4 --ipv4
-6 --ipv6
---connect-timeout <seconds>
--interface <name>
--keepalive-time <seconds>
--limit-rate <speed>
--local-port <num>[-num]
--no-keepalive
--noproxy <list>
-p --proxytunnel
--proxy1.0 <proxyhost[:port]>
--resolve <host:port:address>
--socks4 <host:port>
--socks4a <host:port>
--socks5-hostname <host:port>
--socks5 <host:port>
--socks5-gssapi-service <name>
--socks5-gssapi-nec
-t --telnet-option <OPT=val>
--tcp-nodelay
-x --proxy <protocol:://[user@pw:]host:port>
.
OUTPUT
-a --append
-B --use-ascii
-C --continue-at <offset>
--create-dirs
--crlf
-D --dump-header <file>
--max-filesize <bytes>
-N --no-buffer
-o --output <file>
-O --remote-name (save with remote naming)
-r --range <range> (byte range)
-R --remote-file (set file to remote timestamp)
--raw
--remote-name-all
--stderr <file>
--trace <file>
--trace-ascii <file>
--trace-time
-v --verbose
-w --write-out <format>
--xattr
.
HTTP
-0 --http1.0
-3 --tlsv3
--compressed
--crlfile <file>
--ignore-content-length
-I --head (headers only)
-O --remote-name
-J --remote-header-name
-L --location (follow redirect)
--location-trusted (redirect with name/pw)
--max-redirs <num>
--negotiate
--ntlm
--url <URL>
.
SSL
-1 --tlsv1
-2 --tlsv2
--cyphers <list>
-E --cert <certificate[:password]>
--engine <name>
--egd-file <file>
--cert-type <type>
--cacert <CA certificate>
--capath <CA certificate directory>
-k --insecure
--key <private key file name>
--key-type <DER|PEM|ENG>
--no-sessionid
--random-file <file>
--ssl
--ssl-reqd
.
AUTHENTICATION
--anyauth
--basic
--delegation <none|policy|always>
--digest
--proxy-anyauth
--proxy-basic
--proxy-digest
--proxy-negotiate
--proxy-ntlm
--tlsauthtype <authtype>
--tlsuser <user>
--tlspassword
-u --user <user:password>
-U --proxy-user <user:password>
.
HEADERS
-A --user-agent <string>
-b --cookie <name=data>
-c --cookie-jar <file>
-j --junk-session-cookies
-e --referer <URL>
-H --header <header>
--tr-encoding (compressed transfers)
.
REQUEST
--post301
--post302
-T --upload-file <file>
-X --request <command>
PUT DELETE PATCH, WebDAV
-z --time-cond <date expression>
GET .
-G --get
.
POST DATA .
-d --data <data>
--data-ascii <data>
--data-binary <data>
--data-urlencode <data>
content (no @, =)
=content (allows @, =)
name=content
@filename (filedata)
name@filename (name=filedata)
.
POST .
-F --form <name=content>
name=data
name=data;type=text/foo
name=@index.html;type=text/html
name=@filename;filename=postname
--form-string <name=string> (literal)
.
FTP
--disable-epsc
--ftp-account [data]
--ftp-alternative-to-user <command>
--ftp-create-dirs
--ftp-method [multicwd|nocwd|singlecwd]
--ftp-pasv
--ftp-skip-pasv-ip
--ftp-pret
--ftp-ssl-ccc
--ftp-ssl-ccc-mode [active|passsive]
--ftp-ssl-control
--krv <level>
-- --list-only
-P --ftp-port <interface|ipaddress|hostname|->
-Q --quote <command>
--tftp-blksize <value>
.
SCP/SFTP
--hostpubmd4 <md5>
--pass <phrase>
.
SMTP
--mail-from <address>
--mailprcpt <address>
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.