Wednesday, August 23, 2017

Get Response Time with Curl - curltime

Save this script in your path  (echo $PATH) as curltime:

#!/bin/bash

/usr/bin/curl -o /dev/null \
-s -w "    time_namelookup:  %{time_namelookup}\n       time_connect:  %{time_connect}\n    time_appconnect:  %{time_appconnect}\n   time_pretransfer:  %{time_pretransfer}\n      time_redirect:  %{time_redirect}\n time_starttransfer:  %{time_starttransfer}\n                    ----------\n         time_total:  %{time_total}\n" \
$1


Make it executable

chmod 0755 /usr/local/bin/curltime


Now you can use it to check the response time of an url. Ex:

curltime https://marca.com

Source: based on https://viewsby.wordpress.com/2013/01/07/get-response-time-with-curl/