curl --connect-timeout 5 https://example.comSeparate connect timeout from overall max time.
Tracing, DNS overrides, proxies, protocol selection, config files, timeouts, and script-friendly curl patterns.
Tracing, proxies, DNS overrides, timeouts, and connection tuning.
curl --connect-timeout 5 https://example.comSeparate connect timeout from overall max time.
Abort the request after a fixed total duration.
curl --max-time 20 https://example.comGood for scripts that must not hang forever.
curl --resolve example.com:443:127.0.0.1 https://example.comGreat for testing a site before DNS changes propagate.
Change where curl connects without changing the URL's host name.
curl --connect-to example.com:443:staging.example.net:8443 https://example.comUseful for staging, canaries, and origin testing.
curl -x http://proxy.example.com:8080 https://example.comUse `-x` / `--proxy` for HTTP, HTTPS, SOCKS, and related proxies.
curl --socks5 localhost:1080 https://example.comUseful for debugging network routes or tunneled access.
curl --http2 https://example.comUseful when testing protocol behavior and ALPN negotiation.
Attempt an HTTP/3 transfer when curl build and server support it.
curl --http3 https://example.comHTTP/3 support depends on the curl build and backend support.
curl -4 https://example.comHelpful for troubleshooting mixed IPv4/IPv6 environments.
curl -6 https://example.comUseful when validating IPv6 reachability.
Reusable config files, shell integration, and script-safe patterns.
curl -K request.curlConfig files are useful for long commands and repeatable workflows.
Store headers, auth, and URL in a reusable config file.
url = 'https://api.example.com/v1/items'
header = 'Accept: application/json'
header = 'Authorization: Bearer TOKEN'
silent
show-errorA `.curlrc` or request-specific config file can keep complex commands readable.
curl --json '{"name":"demo"}' https://api.example.com/v1/items`--json` is a convenience option that sets JSON-related defaults.
curl -o '#1-#2.txt' 'https://example.com/{dev,prod}/{a,b}'Output templates pair nicely with URL globbing.
status=$(curl -s -o /tmp/resp.json -w '%{http_code}' https://api.example.com/health)
[ "$status" -eq 200 ] && echo ok || echo failA common automation pattern: body to file, status to shell variable.
curl -s https://api.github.com/repos/curl/curl | jq '.stargazers_count'curl focuses on transfer; pair it with `jq` for JSON processing.
Post the contents of a local file as the request body.
curl -X POST -H 'Content-Type: application/json' --data @payload.json https://api.example.com/itemsPrefix a filename with `@` for `--data` to read from file.
Skip proxy use for selected domains or hosts.
curl --noproxy localhost,127.0.0.1 https://localhost:8443Helpful in mixed environments where a proxy is configured globally.