← Cheatsheets
Linux

curl

curl commands for HTTP requests, authentication, file transfers and TLS inspection.

Basic Requests

curl <url>
curl -s <url>
curl -o file.html <url>
curl -O <url>
curl -L <url>
curl -I <url>
curl -v <url>
curl -w "%{http_code}" -o /dev/null <url>

HTTP Methods & Body

curl -X POST <url>
curl -X DELETE <url>
curl -d "key=value" <url>
curl -d '{"key":"val"}' -H "Content-Type: application/json" <url>
curl -F "file=@photo.jpg" <url>
curl --data-binary @file.txt <url>

Headers & Auth

curl -H "Content-Type: application/json" <url>
curl -H "Authorization: Bearer <token>" <url>
curl -u user:pass <url>
curl -A "MyAgent/1.0" <url>
curl -b "session=abc" <url>
curl -c cookies.txt <url>

TLS & Certs

curl -k <url>
curl --cacert ca.crt <url>
curl --cert client.crt --key client.key <url>
curl --resolve host:443:1.2.3.4 <url>

Output & Inspection

curl -s <url> | jq .
curl -D - -o /dev/null <url>
curl -w "\n%{time_total}s\n" <url>
curl -w "%{size_download} bytes\n" <url>
curl --compressed <url>