Bạn nhận được một đầu ra tiêu đề đẹp với lệnh sau:
curl -L -v -s -o /dev/null google.de
-L, --location theo chuyển hướng
-v, --verbose đầu ra nhiều hơn, chỉ ra hướng
-s, --silent không hiển thị thanh tiến trình
-o, --output /dev/null không hiển thị cơ thể nhận được
Hoặc phiên bản ngắn hơn:
curl -Lvso /dev/null google.de
Kết quả trong:
* Rebuilt URL to: google.de/
* Trying 2a00:1450:4008:802::2003...
* Connected to google.de (2a00:1450:4008:802::2003) port 80 (#0)
> GET / HTTP/1.1
> Host: google.de
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Location: http://www.google.de/
< Content-Type: text/html; charset=UTF-8
< Date: Fri, 12 Aug 2016 15:45:36 GMT
< Expires: Sun, 11 Sep 2016 15:45:36 GMT
< Cache-Control: public, max-age=2592000
< Server: gws
< Content-Length: 218
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
<
* Ignoring the response-body
{ [218 bytes data]
* Connection #0 to host google.de left intact
* Issue another request to this URL: 'http://www.google.de/'
* Trying 2a00:1450:4008:800::2003...
* Connected to www.google.de (2a00:1450:4008:800::2003) port 80 (#1)
> GET / HTTP/1.1
> Host: www.google.de
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Fri, 12 Aug 2016 15:45:36 GMT
< Expires: -1
< Cache-Control: private, max-age=0
< Content-Type: text/html; charset=ISO-8859-1
< P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."
< Server: gws
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< Set-Cookie: NID=84=Z0WT_INFoDbf_0FIe_uHqzL9mf3DMSQs0mHyTEDAQOGY2sOrQaKVgN2domEw8frXvo4I3x3QVLqCH340HME3t1-6gNu8R-ArecuaneSURXNxSXYMhW2kBIE8Duty-_w7; expires=Sat, 11-Feb-2017 15:45:36 GMT; path=/; domain=.google.de; HttpOnly
< Accept-Ranges: none
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
<
{ [11080 bytes data]
* Connection #1 to host www.google.de left intact
Như bạn có thể thấy curlđầu ra cả tiêu đề đi và tiêu đề đến và bỏ qua bodydata mặc dù cho bạn biết cơ thể lớn như thế nào.
Ngoài ra, đối với mỗi dòng, hướng được chỉ định để dễ đọc. Tôi thấy nó đặc biệt hữu ích để theo dõi các chuỗi chuyển hướng dài.
curl --head http://google.comsẽ làm giống như-Icờ :)