curl命令帮助
查看请求时间信息
参考:https://blog.csdn.net/jackyzhousales/article/details/82799494
更多时间参数参考 https://www.cnblogs.com/shell-blog/p/5466905.html
示例:curl www.baidu.com -w "time_connect: %{time_connect}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n"
更多参数参考如下
参数 |
含义 |
|
time_namelookup |
DNS解析域名时间 |
|
time_connect |
TCP连接的时间,三次握手的时间 |
|
time_starttransfer |
从请求开始到第一个字节将要传输的时间 |
|
time_total |
总时间 |
|
speed_download |
下载速度,单位-字节每秒 |
|
time_appconnect |
SSL|SSH等上层连接建立的时间 |
|
time_pretransfer |
从请求开始到响应开始传输的时间 |
|
time_redirect |
从开始到最后一个请求事务的时间 |
指定Header配置hosts
curl -H 'Host:www.test.com' http://10.44.54.111/test.php
或 curl -x 10.44.54.111:80 http://www.test.com/test.php
Slient模式
[@localhost:~]$ curl www.baidu.com -o /tmp/bd % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2381 100 2381 0 0 84101 0 --:--:-- --:--:-- --:--:-- 85035 [@localhost:~]$ curl -s www.baidu.com -o /tmp/bd [@localhost:~]$
显示下载进度条信息
[@localhost:~]$ curl -# www.baidu.com -o /tmp/bd ######################################################################## 100.0% [@localhost:~]$
显示HTTP详情和时间
curl -v http://www.baidu.com --trace-time
14:36:17.465301 * Rebuilt URL to: http://www.baidu.com/ 14:36:17.470683 * Trying 110.242.68.3... 14:36:17.470723 * TCP_NODELAY set 14:36:17.497793 * Connected to www.baidu.com (110.242.68.3) port 80 (#0) 14:36:17.497870 > GET / HTTP/1.1 14:36:17.497870 > Host: www.baidu.com 14:36:17.497870 > User-Agent: curl/7.54.0 14:36:17.497870 > Accept: */* 14:36:17.497870 > 14:36:17.531515 < HTTP/1.1 200 OK 14:36:17.531647 < Accept-Ranges: bytes 14:36:17.531704 < Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform 14:36:17.531759 < Connection: keep-alive 14:36:17.531804 < Content-Length: 2381 14:36:17.531868 < Content-Type: text/html 14:36:17.531948 < Date: Thu, 29 Jul 2021 06:36:17 GMT 14:36:17.531987 < Etag: "588604c1-94d" 14:36:17.532046 < Last-Modified: Mon, 23 Jan 2017 13:27:29 GMT 14:36:17.532349 < Pragma: no-cache 14:36:17.532449 < Server: bfe/1.0.8.18 14:36:17.532518 < Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/ 14:36:17.532589 < <!DOCTYPE html> <!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge><meta content=always name=referrer><link rel=stylesheet type=text/css href=http://s1.bdstatic.com/r/www/cache/bdorz/baidu.min.css><title>百度一下,你就知道</title></head> <body link=#0000cc> <div id=wrapper> <div id=head> <div class=head_wrapper> <div class=s_form> <div class=s_form_wrapper> <div id=lg> <img hidefocus=true src=//www.baidu.com/img/bd_logo1.png width=270 height=129> </div> <form id=form name=f action=//www.baidu.com/s class=fm> <input type=hidden name=bdorz_come value=1> <input type=hidden name=ie value=utf-8> <input type=hidden name=f value=8> <input type=hidden name=rsv_bp value=1> <input type=hidden name=rsv_idx value=1> <input type=hidden name=tn value=baidu><span class="bg s_ipt_wr"><input id=kw name=wd class=s_ipt value maxlength=255 autocomplete=off autofocus></span><span class="bg s_btn_wr"><input type=submit id=su value=百度一下 class="bg s_btn"></span> </form> </div> </div> <div id=u1> <a href=http://news.baidu.com name=tj_trnews class=mnav>新闻</a> <a href=http://www.hao123.com name=tj_trhao123 class=mnav>hao123</a> <a href=http://map.baidu.com name=tj_trmap class=mnav>地图</a> <a href=http://v.baidu.com name=tj_trvideo class=mnav>视频</a> <a href=http://tieba.baidu.com name=tj_trtieba class=mnav>贴吧</a> <noscript> <a href=http://www.baidu.com/bdorz/login.gif?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2f%3fbdorz_come%3d1 name=tj_login class=lb>登录</a> </noscript> <script>document.write('<a href="http://www.baidu.com/bdorz/login.gif?login&tpl=mn&u='+ encodeURIComponent(window.location.href+ (window.location.search === "" ? "?" : "&")+ "bdorz_come=1")+ '" name="tj_login" class="lb">登录</a>');</script> <a href=//www.baidu.com/more/ name=tj_briicon class=bri style="display: block;">更多产品</a> </div> </div> </div> <div id=ftCon> <div id=ftConw> <p id=lh> <a href=http://home.baidu.com>关于百度</a> <a href=http://ir.baidu.com>About Baidu</a> </p> <p id=cp>©2017 Baidu <a href=http://www.baidu.com/duty/>使用百度前必读</a> <a href=http://jianyi.baidu.com/ class=cp-feedback>意见反馈</a> 京ICP证030173号 <img src=//www.baidu.com/img/gs.gif> </p> </div> </div> </div> </body> </html> 14:36:17.565059 * Connection #0 to host www.baidu.com left intact
查看HTTPS证书时间
curl -vv -I https://xkx-orion.xxxx.com
* About to connect() to xkx-orion.xxxx.tv port 443 (#0) * Trying 172.17.31.15... connected * Connected to xkx-orion.xxxx.tv (172.17.31.15) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb * CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 * Server certificate: * subject: CN=*.xxxx.tv * start date: 10月 20 00:00:00 2020 GMT * expire date: 11月 13 23:59:59 2021 GMT ##############这块是证书过期时间 * common name: *.xxxx.tv * issuer: CN=RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1,O=DigiCert Inc,C=US > HEAD / HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: xkx-orion.xxxx.tv > Accept: */* > < HTTP/1.1 200 OK HTTP/1.1 200 OK < Date: Mon, 18 Oct 2021 06:16:50 GMT Date: Mon, 18 Oct 2021 06:16:50 GMT < Content-Type: text/html Content-Type: text/html < Content-Length: 3698 Content-Length: 3698 < Connection: keep-alive Connection: keep-alive < Vary: Accept-Encoding Vary: Accept-Encoding < Last-Modified: Mon, 31 Oct 2016 12:37:31 GMT Last-Modified: Mon, 31 Oct 2016 12:37:31 GMT < ETag: "58173b0b-e72" ETag: "58173b0b-e72" < Accept-Ranges: bytes Accept-Ranges: bytes < * Connection #0 to host xkx-orion.xxxx.tv left intact * Closing connection #0
做有积累的事~~