I was recently looking for an easy way to find the time to first byte (TTFB) for a given url using curl. I wanted to run some script based tests for a bunch of urls over time. I ended up coming up with the following:
curl -w "Connect time: %{time_connect} Time to first byte: %{time_starttransfer} Total time: %{time_total} \n" -o /dev/null [url to test]
This gives you something like the following:
curl -w "Connect time: %{time_connect} Time to first byte: %{time_starttransfer} Total time: %{time_total} \n" -o /dev/null www.google.com
Connect time: 0.402 Time to first byte: 0.453 Total time: 0.475
Hope this is useful to someone else.
Pingback: Timing Details With cURL | Joseph Scott