curl命令查看请求响应时间

curl命令查看请求响应时间

对于一些禁止ping 的网址可以使用curl进行测试

curl -o /dev/null -s -w %{http_code}---%{content_type}---%{time_namelookup}---%{time_namelookup}---%{time_connect}---%{time_starttransfer}---%{time_total}---%{speed_download}"\n" "http://www.baidu.com/"

-o /dev/null:把curl 返回的html、js 写到垃圾回收站[ /dev/null]
-s:去掉所有状态
-w:按照后面的格式写出rt

http_code http状态码

content_type 类型

time_namelookup:DNS 解析域名www.36nu.com的时间

time_commect:client和server端建立TCP 连接的时间

time_starttransfer:从client发出请求;到web的server 响应第一个字节的时间

time_total:client发出请求;到web的server发送会所有的相应数据的时间

speed_download:下载速度 单位 byte/s

--- 分隔符号

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容