ProByte.org Linux tutorials

Check a Website Response Time from the Linux Command Line

Total website response time

Use the following command to get a total response time, in seconds.

 

$ curl -s -w %{time_total}\\n -o /dev/null http://www.shellhacks.com

Sample output:

0,117

Brief options description:

Option Description
-s Quiet mode. Don’t show progress meter or error messages
-w Defines what to display on stdout after a completed and successful operation
-o Write output to ‘/dev/null’
time_total The total time, in seconds, that the full operation lasted

Detailed timing of a website response

The following command returns lookup, connect, pretransfer, starttransfer time in seconds and the total time that the full operation lasted.

$ curl -s -w ‘\nLookup time:\t%{time_namelookup}\nConnect time:\t%{time_connect}\nPreXfer time:\t%{time_pretransfer}\nStartXfer time:\t%{time_starttransfer}\n\nTotal time:\t%{time_total}\n’ -o /dev/null http://www.shellhacks.com

Sample output:

Lookup time:    0,004Connect time:   0,022PreXfer time:   0,022StartXfer time: 0,068 Total time:     0,125

Brief options description:

Option Description
Lookup time (time_namelookup) The time, in seconds, it took from the start until the name resolving was completed
Connect time (time_connect) The time, in seconds, it took from the start until the TCP connect to the remote host was completed
PreXfer time (time_pretransfer) The time, in seconds, it took from the start until the file transfer was just about to begin. This includes all ‘pre-transfer’ commands and negotiations that are specific to the particular protocol(s) involved
StartXfer time (time_starttransfer) The time, in seconds, it took from the start until the first byte was just about to be transferred. This includes ‘time_pretransfer’ and also the time the server needed to calculate the result

More detailed timing of a website response

The following command adds appconnect and redirect time in seconds, to the previous report. These options are available in a latest versions of CURL.

curl -s -w ‘\nLookup time:\t%{time_namelookup}\nConnect time:\t%{time_connect}\nAppCon time:\t%{time_appconnect}\nRedirect time:\t%{time_redirect}\nPreXfer time:\t%{time_pretransfer}\nStartXfer time:\t%{time_starttransfer}\n\nTotal time:\t%{time_total}\n’ -o /dev/null http://www.shellhacks.com

Sample output:

Lookup time:    0,003Connect time:   0,020AppCon time:    0,000Redirect time:  0,000PreXfer time:   0,020StartXfer time: 0,963 Total time:     1,001

Leave a Reply

Your email address will not be published. Required fields are marked *