Skip to content

Instantly share code, notes, and snippets.

@chrisiona
Last active November 12, 2020 09:11
Show Gist options
  • Save chrisiona/fe09d04eb652d2b54a0e to your computer and use it in GitHub Desktop.
Save chrisiona/fe09d04eb652d2b54a0e to your computer and use it in GitHub Desktop.
TTFB – Bash script that returns interesting information about a HTTP/S call
#!/bin/bash
# Returns interesting information about a HTTP/S call
# http://chrisiona.com/post/125309997618/ttfb-a-bash-script-that-returns-interesting
curl -so /dev/null \
-w "Response Code: \t\t%{http_code} \
\nName Resolution: \t%{time_namelookup} sec\
\nConnect Time: \t\t%{time_connect} sec\
\nPre Transfer: \t\t%{time_pretransfer} sec\
\nStart Transfer: \t%{time_starttransfer} sec\
\nTotal: \t\t\t%{time_total} sec\
\nSpeed Download: \t%{speed_download} bytes/sec \
\nSize: \t\t\t%{size_download} bytes \
\n\n" \
$1
@chrisiona
Copy link
Author

[chris@iones ~]# ./ttfb.sh www.homeimprovementpages.com.au
Response Code:      200       
Name Resolution:    0.004 sec      
Connect Time:       0.006 sec      
Pre Transfer:       0.006 sec      
Start Transfer:     0.172 sec      
Total:              0.196 sec      
Speed Download:     1719973.000 bytes/sec       
Size:               337844 bytes 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment