More than 5 years have passed since last update.
cURLでHTTPステータスコードだけを取得する
322
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)を指定して「進捗どうですか?」を表示しないようにする。
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
