1.在shell中获取http 的返回值(以域名为测试)
curl -I -m 10 -o /dev/null -s -w %{http_code} www.baidu.com
2.以ip 为测试获取http 的返回值
curl -I -m 10 -o /dev/null -s -w %{http_code} ip
如果需要换行的话,加上\n 就可
如下: curl -I -m 10 -o /dev/null -s -w %{http_code}"\n"ip
3.开启gzip 请求
curl -I http://www.sina.com.cn/ -H Accept-Encoding:gzip,defalte
4.监控网页的响应时间:
curl -o /dev/null -s -w "time_connect: %{time_connect}\ntime_starttransfer
: %{time_starttransfer}\ntime_total: %{time_total}\n" "http://www.kklinux.com"