curl的常见用法示例
1、显示 HTTP 头
[root@micro1-Customer01 tmp]# curl -I http://172.16.3.125:9041/info HTTP/1.1 200 X-Application-Context: pj-ae-loan:9041 Content-Type: application/vnd.spring-boot.actuator.v1+json;charset=UTF-8 Content-Length: 2 Date: Thu, 08 Feb 2018 09:44:58 GMT
2、
[root@micro1-Customer01 tmp]# curl -I -w "%{http_code}\n" -o /dev/null http://172.16.3.125:9041/info % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 2 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 200
-o(小写的 o):结果会被保存到命令行中提供的文件名
3、-s 静默模式。不输出任何东西
[root@micro1-Customer01 tmp]# curl -I -s -w "%{http_code}\n" -o /dev/null http://172.16.3.125:9041/info
200

浙公网安备 33010602011771号