Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
curl command to check the time to first byte
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
-w "Connect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n" \
$1
@vaclav-kasal

This comment has been minimized.

Copy link

commented Feb 15, 2018

With -Iz I get bad numbers(zeroes). I use seq 10 | xargs -n 1 ttfb google.com and works as expected.

@jaygooby

This comment has been minimized.

Copy link

commented Apr 11, 2019

Thanks for this @sandeepraju!

I've turned it into a more fully fledged utility here: https://github.com/jaygooby/ttfb.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.