How to Test Website response time in Linux Terminal?

Website response time can have a greater impact on the user side. The web developer Os a server administrator is responsible to optimize the website so that the users don’t feel frustrated while accessing the website. In this tutorial, we are going to discuss how to test a website response from the command line.

You can view the output of website performance using the “curl” command which is the powerful tool to transfer data from or to a server. curl can be used as a command line downloader in most cases. curl command has a useful option “-w” for printing information after an operation. You can use the below command to view the “website response time”.

# curl -s -w ‘Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n’ -o /dev/null website url

Example:

root@server [/]# curl -s -w ‘Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n’ -o /dev/null http://www.google.com

Testing Website Response Time for :http://www.google.com/

Lookup Time:            0.018

Connect Time:           0.019

Pre-transfer Time:      0.019

Start-transfer Time:    0.056

Total Time:             0.056

 

curl -s -w ‘Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n’ -o /dev/null http://tellisports.com/

Testing Website Response Time for :http://tellisports.com/

Lookup Time:            0.031

Connect Time:           0.031

Pre-transfer Time:      0.031

Start-transfer Time:    0.077

Total Time:             0.088

 

For https you can run the below command.

# curl -s -w ‘Testing Website Response Time for :%{url_effective}\n\nLookup Time:\t\t%{time_namelookup}\nConnect Time:\t\t%{time_connect}\nAppCon Time:\t\t%{time_appconnect}\nRedirect Time:\t\t%{time_redirect}\nPre-transfer Time:\t%{time_pretransfer}\nStart-transfer Time:\t%{time_starttransfer}\n\nTotal Time:\t\t%{time_total}\n’ -o /dev/null https://www.google.com

Lookup Time:            0.018

Connect Time:           0.019

AppCon Time:            0.374

Redirect Time:          0.000

Pre-transfer Time:      0.374

Start-transfer Time:    0.392

Total Time:             0.392

 

Lookup time: (time_namelookup): Time in seconds, it took from the start until the name resolving was completed.

Connect time: (time_connect ): Time in seconds, it took from the start until the TCP connect to the remote host was completed.

PreXfer time: (time_pretransfer): Time, in seconds, it took from the start until the file transfer was just about to begin.

StartXfer time: (time_starttransfer): Time, in seconds, it took from the start until the first byte was just about to be transferred.

time_appconnect: (AppCon Time): Time, in seconds, it took from the start until the SSL connect/handshake to the remote host was completed.

time_redirect: (Redirect time): Time, in seconds, it took for all redirection steps including name lookup, connect and transfer before the final transaction was started. It provides the full execution time for multiple redirections.

time_total: Total time, in seconds, that the full operation lasted.

 

Command Options:

-s: Describes the curl to work silently.

-w: Print the information to stdout.

-o: used to redirect output.

 

If you need any further help please do reach our support department.