1、计算curl相关时间命令:
date;curl -w "Result: \n request_time:%{time} \n dnslookup: %{time_namelookup} \n connect: %{time_connect} \n appconnect: %{time_appconnect} \n pretransfer: %{time_pretransfer} \n starttransfer: %{time_starttransfer} \n total: %{time_total} \n ----\n time_redirect: %{time_redirect} \n ----\n size: %{size_download}\n" "http://blog.ganyongmeng.com/"
参数说明:
time_namelookup:DNS 域名解析的时间,就是把http://blog.ganyongmeng.com/ 转换成ip地址的过程 time_connect:TCP 连接建立的时间,就是三次握手的时间 time_appconnect:SSL/SSH等上层协议建立连接的时间,比如 connect/handshake 的时间 time_pretransfer:从请求开始到响应开始传输的时间 time_starttransfer:从请求开始到第一个字节将要传输的时间 time_total:这次请求花费的全部时间
2、获取服务器对外IP:
curl http://httpbin.org/ip
转载请注明:永盟博客 » CURL常用命令汇总