Skip to content

Instantly share code, notes, and snippets.

@jokester
Created August 6, 2018 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jokester/21ae4b23d6ff4f040509b7c13f774705 to your computer and use it in GitHub Desktop.
Save jokester/21ae4b23d6ff4f040509b7c13f774705 to your computer and use it in GitHub Desktop.
Test speed with curl
#!/usr/bin/env bash
set -u
if [[ 0 -eq "$#" ]]; then
echo "Test ttfb and stuff of GET request"
echo " USAGE: $0 URL+"
exit 1
fi
for url in "$@"; do
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-vv -s --compressed \
-w "
URL: %{url_effective}
DNS lookup: %{time_namelookup} | Connect: %{time_connect} | TTFB: %{time_starttransfer} | Total time: %{time_total} | Avg Speed: %{speed_download} B/s
" \
"$url"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment