curl 文件传输工具
参数:
1 1 -c --cokie-jar: 将cookie写入到文件 2 2 -b --cokie: 从文件中读取cookie 3 3 -C --continue-at: 断点续传 4 4 -d --data: http post 方式传送数据 5 5 -D --dump-header:把header信息写入到文件 6 6 -F --from: 模拟http表达提交数据 7 7 -s -slient: 减少输出信息 8 8 -o --output:将信息输出到文件 9 9 -O --remote-name: 按照服务器上的文件名,存储在本地 10 10 -I --head:仅返回头部信息 11 11 -u --user[user:pass]: 设置http认证用户名和密码 12 12 -T --upload-file: 上传文件 13 13 -e --referer:指定应用地址 14 14 -x --proxy: 指定代理服务器地址和端口 15 15 -w --write-out:输出指定格式内容 16 16 --retry: 重试次数 17 17 --connect-timeout: 指定尝试连接的最大时间
curl 查看请求响应时间
[root@localhost ~]# curl -o /dev/null -s -w time_namelookup:%{time_namelookup}" "time_connect:%{time_connect}" "time_appconnect:%{time_appconnect}" "time_redirect:%{time_redirect}" "time_pretransfer:%{time_pretransfer}" "time_starttransfer:%{time_starttransfer}" "time_total:%{time_total}" "speed_download:%{speed_download}" " https://www.baidu.com time_namelookup:0.005 time_connect:0.038 time_appconnect:0.244 time_redirect:0.000 time_pretransfer:0.244 time_starttransfer:0.280 time_total:0.280 speed_download:8726.000
time_namelookup:DNS 域名解析的时候,就是把https://www.baidu.com
转换成 ip 地址的过程
time_connect:TCP 连接建立的时间,就是三次握手的时间
time_appconnect:SSL/SSH 等上层协议建立连接的时间,比如 connect/handshake 的时间
time_redirect:从开始到最后一个请求事务的时间
time_pretransfer:从请求开始到响应开始传输的时间
time_starttransfer:从请求开始到第一个字节将要传输的时间
time_total:这次请求花费的全部时间
speed_download:下载速度 单位 byte/s
-
-w
:从文件中读取要打印信息的格式 -
-o /dev/null
:把响应的内容丢弃,因为我们这里并不关心它,只关心请求的耗时情况 -
-s
:不要打印进度条
wget 文件下载工具
2.1 启动参数
-V,–version:显示版本号
-h,–help:查看帮助
-b,–background:启动后转入后台执行
2.2 日志记录和输入文件参数
-o,–output-file=file:把记录写到file文件中
-a,–append-output=file:把记录追加到file文件中
-i,–input-file=file:从file读取url来下载
2.3 下载参数
-bind-address=address:指定本地使用地址
-t,-tries=number:设置最大尝试连接次数
-c,-continue:接着下载没有下载完的文件
-O,-output-document=file:将下载内容写入到file文件中
-spider:不下载文件
-T,-timeout=sec:设置响应超时时间
-w,-wait=sec:两次尝试之间间隔时间
–limit-rate=rate:限制下载速率
-progress=type:设置进度条
2.4 目录参数
-P,-directory-prefix=prefix:将文件保存到指定目录
2.5 HTTP参数
-http-user=user:设置http用户名
-http-passwd=pass:设置http密码
-U,–user-agent=agent:伪装代理
-no-http-keep-alive:关闭http活动链接,变成永久链接
-cookies=off:不使用cookies
-load-cookies=file:在开始会话前从file文件加载cookies
-save-cookies=file:在会话结束将cookies保存到file文件
2.6 FTP参数
-passive-ftp:默认值,使用被动模式
-active-ftp:使用主动模式
2.7 递归下载排除参数
-A,–accept=list:分号分割被下载扩展名的列表
-R,–reject=list:分号分割不被下载扩展名的列表
-D,–domains=list:分号分割被下载域的列表
–exclude-domains=list:分号分割不被下载域的列表