Skip to content

Instantly share code, notes, and snippets.

@hn-support
Last active October 9, 2017 12:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hn-support/885fa037aaad17576cb9f44703c879ef to your computer and use it in GitHub Desktop.
Save hn-support/885fa037aaad17576cb9f44703c879ef to your computer and use it in GitHub Desktop.
Test urls using curl
#!/bin/bash
# This script is a very basic curl utility to analyze urls.
# To use it, download the file, make it executable, and run:
# ./curl_speedtest.sh https://www.byte.nl
URL="$1"
if [ "x${URL}" == "x" ] || [[ ! "${URL}" =~ "http" ]] ; then
echo "Usage: $0 <url>"
exit 1
fi
curl -L -so /dev/null -w "\n[Info]\n\nStatus Code:\t%{http_code}\nHTTP Version:\t%{http_version}\nRemote IP:\t%{remote_ip}\n\n[Timing]\n\nConnect:\t%{time_connect}\tseconds\nPre-Transfer:\t%{time_pretransfer}\tseconds\nRedirect Time:\t%{time_redirect}\tseconds\nTransfer:\t%{time_starttransfer}\tseconds\nDNS Lookup:\t%{time_namelookup}\tseconds\nTotal Time:\t%{time_total}\tseconds\n\n[Size]\n\nDownload Size:\t%{size_download}\tbytes\nHeader Size:\t%{size_header}\tbytes\nRequest Size:\t%{size_request}\tbytes\n" $URL ; echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment