Check a Website's HTTP Status Code with curl
Print just the HTTP status code and response time of any URL with curl, ideal for health checks and quick monitoring from the terminal.
01Command
$ curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" https://example.com02What it does
The -o /dev/null part throws the page body away so only the summary is printed, while -w writes selected variables after the transfer finishes — %{http_code} is the status (200, 301, 404, 500...) and %{time_total} the whole-request time in seconds. This works well in shell scripts and cron jobs as a poor man's uptime check: anything other than 2xx means something changed. Add -L if you want curl to follow redirects before reporting the final code.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- curl(1) — Linux manual pageEvidence: Documents -o, -s and -w/--write-out variables such as http_code and time_total for summarizing a transfer.
- curl man page — -w / --write-out and %{http_code}Evidence: Documents the --write-out variables including http_code and time_total, used to print the response status and timing after a request.
Last verified: 2026-09-18 · Category: Network
06Related solutions
Launch an interactive process viewer with color meters for CPU cores, memory, and swap, plus search, sort, and kill controls.
Show total, used, and available space plus usage percentage for every mounted filesystem in human-readable units.
The classic forgotten-syntax command: `traceroute` shows every router between you and a destination plus the round-trip time of probes to each hop.