Docs/linux基础/curl只打印状态信息.txt

33 lines
No EOL
931 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

curl -I -m 10 -o /dev/null -s -w %{http_code} www.baidu.com
-I 仅测试HTTP头
-m 10 最多查询10s
-o /dev/null 屏蔽原有输出信息
-s silent 模式,不输出任何东西
-w %{http_code} 控制额外输出
常用参数:
-v/--verbose 小写的v参数用于打印更多信息包括发送的请求信息这在调试脚本是特别有用。
-m/--max-time <seconds> 指定处理的最大时长
-H/--header <header> 指定请求头参数
-s/--slient 减少输出的信息,比如进度
--connect-timeout <seconds> 指定尝试连接的最大时长
-x/--proxy <proxyhost[:port]> 指定代理服务器地址和端口端口默认为1080
-T/--upload-file <file> 指定上传文件路径
-o/--output <file> 指定输出文件名称
-d/--data/--data-ascii <data> 指定POST的内容
--retry <num> 指定重试次数
-e/--referer <URL> 指定引用地址
-I/--head 仅返回头部信息使用HEAD请求