- Create a new file, curl-format.txt, and paste in:
time_namelookup: %{time_namelookup}s\n time_connect: %{time_connect}s\n time_appconnect: %{time_appconnect}s\n time_pretransfer: %{time_pretransfer}s\n time_redirect: %{time_redirect}s\n time_starttransfer: %{time_starttransfer}s\n ----------\n time_total: %{time_total}s\n
- Make a request:
curl -w "@curl-format.txt" -o /dev/null -s "http://example.com/"
- To output only average time, try this:
curl -w "@curl-format.txt" -o /dev/null -s "http://example.com/" |grep time_total
the output will be something like that:
time_total: 0.085987s
- To make multiple requests, just add another url’s:
curl -w "@curl-format.txt" -o /dev/null -s "http://example.com/" "http://example.com/" "http://example.com/" "http://example.com/" |grep time_total
Linux cheat sheet