curl简单使用

curl simple usage

a long time ago,i wanna to find a tool which can test bandwidth when i use proxy.later i find a tool named speedtest-cli,however it cannot be used with proxychains.at last i find a method to download the webpage of google using curl and calculate the time downloading.in a fact,it is not reliabled.

today i find that the curl itself has a argument which can calculate the time accessing webpage.

1
2
--- ~ » curl -s -w "%{time_total}\n" -o /dev/null www.biadu.com
1.409707

while used in script,we need add timeout

1
--- ~ » timeout 4 curl -s -w "%{time_total}\n" -o /dev/null www.biadu.com

it can also get the header of webpage.

1
2
3
4
5
6
7
8
9
10
11
12
--- ~ » curl -I www.baidu.com      
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: keep-alive
Content-Length: 277
Content-Type: text/html
Date: Thu, 26 Mar 2020 08:33:34 GMT
Etag: "575e1f72-115"
Last-Modified: Mon, 13 Jun 2016 02:50:26 GMT
Pragma: no-cache
Server: bfe/1.0.8.18