$ curl -Lw '%{http_code}' -s -o /dev/null -I SOME_URL

June 19, 2017, 11:15 p.m.Janos


  • -w '%{http_code}' is to print out the status code (the meat of this post)
  • -s is to make curl silent (suppress download progress stats output)
  • -o /dev/null is to redirect all output to /dev/null
  • -I is to fetch the headers only, no need for the page content
  • -L is to follow redirects