curl Power User Tricks
curl flags for incident response.
Verbose
curl is the universal HTTP client. Power users go beyond basic GET and POST; verbose output, timing analysis, and retry handling are where curl earns its keep during incident investigation.
curl -vshows headers. The verbose flag prints request and response headers. Debugging stays grounded in what actually went over the wire rather than what the client library says it sent.curl -vvshows TLS handshake. Cipher suites, certificate validation, and protocol versions become visible. When TLS fails, -vv reveals whether the cause is cert, protocol, or cipher mismatch.- Triple verbose.
-vvvadds even more detail. Use sparingly; the output is overwhelming for most diagnoses but useful when chasing connection-reuse subtleties. - Pipe to grep. Verbose output piped to grep extracts specific patterns.
curl -v ... 2>&1 | grep -i 'tls\|cert'isolates the layer of interest.
Timing
curl can measure timing. The breakdown separates DNS, connect, response, and total so a slow request points at a specific layer rather than a vague "the network is slow".
- Total time.
curl -w "%{time_total}\n"outputs the total. The format string mechanism unlocks every timing field curl tracks. - Per-stage breakdown.
%{time_namelookup},%{time_connect}, and%{time_starttransfer}separate DNS, TCP, and time-to-first-byte. Each one points at a different remediation. - DNS versus connect versus response. Slow requests have specific causes. The breakdown reveals which layer is slow rather than leaving the engineer to guess.
- Saved format strings.
curl --write-out @timing.fmtreuses a saved format file across investigations. The team's timing format becomes consistent across engineers.
Retry and timeouts
Production use of curl in scripts benefits from retry and timeout flags. The discipline produces automation that survives network blips without retrying forever.
- Retry plus connect timeout.
curl --retry 3 --connect-timeout 5handles transient failures and slow connects. Three retries with a five-second connect timeout bounds the script's behaviour. - Useful in scripts. Manual curl rarely needs retry; scripted curl often does. Network blips, rate limits, and transient errors all become non-fatal with retry.
- Retry delay.
--retry-delayconfigures the wait between retries.--retry-all-errors --retry-delay 1with default backoff prevents hammering a server that is recovering. - Total time and fail-with-body.
--max-timebounds the total request;--fail-with-bodytreats HTTP errors as exit failures. Scripts catch non-2xx responses without parsing exit codes by hand.
curl power user is one of those CLI tooling disciplines that pays off in HTTP investigation and automation. Nova AI Ops integrates with API observability, complementing CLI-driven analysis.