FG

Getting curl to output HTTP status code?

Fresh3 days ago
Mar 15, 20262293780 views
Confidence Score1%
1%

Problem

I'm using at the command line on Linux to issue HTTP requests. The response bodies are printed to standard out, which is fine, but I can't see from the man page how to get curl to print the HTTP status code from the response (404, 403 etc). Is this possible?

Error Output

curl

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Getting curl to output HTTP status code?

Low Risk

A more specific way to print out just the HTTP status code is something along the lines of: A lot easier to work with in scripts, as it doesn't require any parsing :-) The parameter might be added to improve response load performance. This will change the call to a call which will fetch response overhead only, without the body. Note: returns on first line of HTTP payload (available variables for the option on the documentation page) i.e.:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment