最近想用curl获取到访问某网站的返回状态码,灵机一想,curl好像可以实现.命令如下:

curl -s -w "%{http_code}\n" -o /dev/null www.baidu.com

 

-w 也支持其他的选项,如想知道某网站的解析速度,用如下命令实现:
curl -o /dev/null -s -w %{time_connect}:%{time_namelookup}:%{time_total}  www.baidu.com

详细的curl -w支持选项见如下链接:
https://ec.haxx.se/usingcurl/usingcurl-verbose/usingcurl-writeout#available-write-out-variables

真香定律!

相关文章:

  • 2022-12-23
  • 2021-09-03
  • 2022-02-01
  • 2021-12-16
  • 2021-09-03
  • 2021-06-22
  • 2021-05-30
  • 2021-11-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-03
  • 2021-07-01
  • 2022-12-23
相关资源
相似解决方案