How To Test Loading Speed of Website with Terminal

How to test the loading speed of a website from the Linux command terminal.

The speed with which a website responds to a request is crucial for the site to gain a reputation, users feel comfortable, and everything works in an ideal way.

In this tutorial, we will see how it is possible to test the speed of a website through the Linux terminal. Some parameters play a fundamental role there such as:

  • The time it takes to resolve the domain name.
  • The TCP connection to the server.
  • The transferred files and more.

For this, we will use a tool called CURL.

Check Loading Speed of a Website on Linux

For this we open the terminal console and execute the following line with the name of the desired website:

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 thelinuxcode.com

In this command the variables that we have used are:

  • time_namelookup: It refers to the time, measured in seconds, of the total time the request was sent until it got a response.
  • time_connect: It covers all the time, in seconds, when the TCP protocol connection was completed to the remote computer.
  • time_pretransfer: It refers to the time, also in seconds, when the file transfer was started.
  • time_starttransfer: It comprises the time in which the first byte was about to be transmitted to the remote equipment.
  • time_total: It indicates the total time that was used, in seconds, to complete the response action by the remote team.

In the case of sites protected with HTTPS, we can execute the following:

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 http://thelinuxcode.com

In this case of HTTPS we have used the following variables:

  • time_appconnect: This value refers to the time measured in seconds of the entire SSL communication process between the source equipment and the remote equipment.
  • time_redirect: It is the time where the redirection process was involved, where actions such as connection, name analysis and more are included.

Each time we execute the command we will receive a new time due to the loads that the server may or may not be running at that moment.

We can use these options to know, in real time, what is the loading time of a website and we emphasize that it will always take a little longer, for security, to load a secure site.

In case of knowing more about CURL we can execute the following command:

man curl

As we see through these commands we can verify the loading speed in a website in Linux

Similar Posts

Leave a Reply

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