0% found this document useful (0 votes)
8 views

Curl Command Cheatsheet

This document is a cheat sheet for the curl command, providing syntax, basic operations, data transfer methods, authentication, headers, and other useful options. It includes examples for common tasks such as fetching URLs, downloading files, and using SSL certificates. Additionally, it offers debugging commands and information on how to display help and version details.

Uploaded by

cigomid552
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Curl Command Cheatsheet

This document is a cheat sheet for the curl command, providing syntax, basic operations, data transfer methods, authentication, headers, and other useful options. It includes examples for common tasks such as fetching URLs, downloading files, and using SSL certificates. Additionally, it offers debugging commands and information on how to display help and version details.

Uploaded by

cigomid552
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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

You might also like