LoginSignup
324
233

More than 5 years have passed since last update.

cURLでHTTPステータスコードだけを取得する

Last updated at Posted at 2013-12-30

curlでHTTPステータスコードだけを取得する方法をいつも忘れるのでメモ。

$ curl -LI mazgi.com -o /dev/null -w '%{http_code}\n' -s
200

こんな感じで -w (write out)で http_code を指定しつつ、他は -o (output)で /dev/null にでも捨てる。
そして -s (silent)を指定して「進捗どうですか?」を表示しないようにする。

324
233
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
324
233