CURL is a powerful command-line tool for making HTTP requests, testing APIs, uploading data, and more. This cheatsheet provides essential commands and use cases for ethical hackers, penetration testers, and developers. Whether you’re automating security tests or debugging APIs, this guide has you covered.
CURL Cheatsheet
The Ultimate Command Line Tool for Data Transfer
Basic CURL Requests
curl https://example.com
curl -o output.html https://example.com
curl -L https://example.com
curl -v https://example.com
curl -k https://example.com
curl --limit-rate 100K https://example.com
curl -A "Mozilla/5.0" https://example.com
curl -I https://example.com
HTTP Methods
curl -X POST https://example.com
curl -X PUT https://example.com
curl -X DELETE https://example.com
curl -X PATCH https://example.com
curl -X HEAD https://example.com
curl -X PURGE https://example.com
Headers & Authentication
curl -H "X-Custom-Header: value" https://example.com
curl -u username:password https://example.com
curl -H "Authorization: Bearer token" https://example.com
curl -H "Accept: application/json" -H "Content-Type: application/json" https://example.com
curl --digest -u username:password https://example.com
curl -e "https://referer.com" https://example.com
curl -b "name=value" https://example.com
curl -c cookies.txt https://example.com
curl -b cookies.txt https://example.com
Data Transfer
curl -d "name=value" https://example.com
curl -d "name1=value1" -d "name2=value2" https://example.com
curl -d '{"key":"value"}' -H "Content-Type: application/json" https://example.com
curl -d @data.json https://example.com
curl --data-urlencode "name=value" https://example.com
curl -F "name=value" -F "file=@filename.jpg" https://example.com
curl --data-binary "@data.bin" https://example.com
curl -X POST -H "Content-Type: application/json" -d '{"query":"{user{name}}"}' https://example.com/graphql
File Transfer
curl -O https://example.com/file.zip
curl -o customname.zip https://example.com/file.zip
curl -C - -O https://example.com/file.zip
curl -u user:password -O ftp://example.com/file.zip
curl -T localfile.zip -u user:password ftp://example.com/
curl -u user sftp://example.com/file.zip -o localfile.zip
curl -u user -T localfile scp://example.com/
curl -O https://example.com/file1.zip -O https://example.com/file2.zip
Advanced Options
curl -x http://proxy:port https://example.com
curl --socks5 host:port https://example.com
curl -6 https://example.com
curl -4 https://example.com
curl --connect-timeout 10 https://example.com
curl --max-time 30 https://example.com
curl --retry 3 https://example.com
curl --interface eth0 https://example.com
curl --resolve example.com:443:1.2.3.4 https://example.com
curl --tlsv1.2 https://example.com
curl --cert client.pem --key key.pem https://example.com
curl --cacert ca-bundle.crt https://example.com
Output Options
curl -s https://example.com
curl -# -O https://example.com/file.zip
curl -S -s https://example.com
curl -o output.txt https://example.com
curl -a -o log.txt https://example.com
curl -i https://example.com
curl -v https://example.com
curl -D headers.txt https://example.com
Common Use Cases
curl -I https://example.com
curl -X POST -H "Content-Type: application/json" -d '{"param":"value"}' https://api.example.com/endpoint
curl -u user:password -O https://example.com/file.zip
curl -F "file=@localfile.jpg" https://api.example.com/upload