Skip to content

Instantly share code, notes, and snippets.

@drobune
Created December 12, 2014 07:11
Show Gist options
  • Save drobune/e03d64ef7ba02864781a to your computer and use it in GitHub Desktop.
Save drobune/e03d64ef7ba02864781a to your computer and use it in GitHub Desktop.
get only status code on curl
curl -LI mazgi.com -o /dev/null -w '%{http_code}\n' -s
@kuboon
Copy link

kuboon commented Jan 31, 2025

-I outputs headers. -X HEAD changes method and keep outputs body (=nothing). so you can omit -o part like this

curl -X HEAD -sw '%{http_code}\n' example.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment