Skip to main content
Kill -9 Club
Sign in

curl

NetworkPackage: curl

Sends an HTTP (or other) request and shows the response. curl -I reads only the headers, -v shows the whole exchange, TLS included — that is how you tell "the server answers badly" from "the server does not answer".

What its options do in the lessons

From the same glossary the lessons render under their commands, so the two cannot disagree.

curl -I
HEAD request: fetches the headers only.
curl -v
Verbose: shows every step of the connection — including the one that fails — before any HTTP is exchanged.
curl -L
Follows redirects instead of stopping at the 3xx response.
curl -s
Silent: no progress meter and no error messages.
curl -S
With -s, still shows errors. -sS gives “quiet but not silent”.
curl -f
Fails with a non-zero exit code on an HTTP response of 400 or more, instead of saving the error page as though it were the content.
curl -w
Prints a template after the response, where %{http_code} becomes the HTTP status. With -o /dev/null the page is discarded and only the number is left — which is what a check wants to read.
curl -H
Adds a header to the request. -H 'Host: example.com' makes the web server pick that name's virtual host while you are querying a bare IP address: it is how a site gets tested before DNS points at it.
curl -o
Writes to a file instead of standard output.
curl -m
Maximum time for the whole transfer, in seconds. Without it, a check script can wait forever.
curl --data-binary
Sends the request body exactly as given, with no re-encoding and no stripping of newlines, unlike -d. The @file form reads the body from a file, which is what testing a size limit with real bytes needs.
curl --resolve
Pins a hostname to an address you choose, for this request only (--resolve example.com:443:198.51.100.25). Used to test a new machine’s vhost and certificate while DNS still points at the old one.

Lessons that teach it

curl — command reference | Kill -9 Club