I know that I can get the time_total of of curl request by using this command:

curl https://www.google.com -s -o /dev/null -w "%{time_total}\n"

Is there any way for me to easily compare the results of the time_total of two sites?

For example, if I have the two commands:

curl https://www.google.com -s -o /dev/null -w  "%{time_total}\n"
curl https://www.yahoo.com -s -o /dev/null -w  "%{time_total}\n"

Rather than running them separately, I'd love to have a single command (i.e. I only have to press Enter once) that I can run that would display something like:

0.186356 - https://www.google.com
0.535030 - https://www.yahoo.com

Is that possible?

1 Answer 1


Just write a function for it:

speedtest() {
    for url
      curl "$url" -s -o /dev/null -w  "%{time_total} - $url\n"

Then you can run it on as many urls as you want:

$ speedtest https://www.google.com https://www.yahoo.com
0.055323 - https://www.google.com
0.544956 - https://www.yahoo.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.