curl 命令速查表
用于 API 调试与自动化的 HTTP 客户端命令:请求方法、JSON 载荷、请求头、认证、多部分上传、Cookie、重试与 curl 8.x 上的 TLS 诊断。
工作原理
curl transfers URL data from the shell: set method (-X), headers (-H), body (-d/-F), and output (-v/-i/-w) explicitly, because curl prints only the response body by default.
生存指南
最先需要掌握的少数几个命令。
42 条命令
Requests & Methods
Send GET, HEAD, POST, PUT, PATCH, and DELETE requests with clean headers.
- 基础必备
Fetch a URL and print the response body to stdout
curl <url>构建命令
curl <url>输入的值将按原样插入。若包含空格或特殊字符,请自行添加引号。
适用场景
Baseline check for reachability, response payload, and pipe integration with jq.
示例
curl https://api.example.com/health运行结果
{"status":"ok","version":"2.4.0"}
Payloads, Forms & Files
Send JSON, URL-encoded forms, multipart uploads, and binary bodies.
Auth, Cookies & TLS
Authenticate requests, manage cookies, resolve hosts, and verify certificates.
Headers, Timing & Debugging
Inspect TLS handshakes, response headers, status codes, and per-phase latency.
Downloads, Retries & Limits
Write files safely, resume interrupted downloads, cap wait time, and retry.