Getting connection speed metrics from curl (BASH)

The command gets curl to request a page and then write out a CSV delimited line giving details of the time it took to complete various stages of the request, including how many redirects were followed etc.

Details

  • Language: BASH

Snippet

curl -o /dev/null -w "%{http_code},\"$URL\",\"%{url_effective}\",%{time_total},%{time_namelookup},%{time_connect},%{time_redirect},%{time_starttransfer},%{size_download},%{size_request}\n" $URL

Usage Example

URL="https://www.google.com"
curl -o /dev/null -w "%{http_code},\"$URL\",\"%{url_effective}\",%{time_total},%{time_namelookup},%{time_connect},%{time_redirect},%{time_starttransfer},%{size_download},%{size_request}\n" $URL

Video