Skip to content

Instantly share code, notes, and snippets.

@henri
Last active February 12, 2025 02:43
Show Gist options
  • Save henri/7c2243bd9f9bfc25a8321341e4ace6b5 to your computer and use it in GitHub Desktop.
Save henri/7c2243bd9f9bfc25a8321341e4ace6b5 to your computer and use it in GitHub Desktop.
curl cheatsheet
# check the total real page load time for a specific page load :
TIMEFORMAT='%E' ; time curl https://myserver.com 2> /dev/null >/dev/null
#!/usr/bin/env bash
#
# Henri Shustak 2025
#
# LICENCE GNU-GPL v3 or later
#
# Modify as needed :)
#
# ABOUT : This script will load the supplied URL and time how long it takes to get a responce.
#
# version 0.1
# show usage if an argument was not passed in or if the first argument is not starting with http or https
if [ ! ${#} == 1 ] || [ ! $(echo "${1}" | grep -E "^http|^https") ] ; then
echo "Usage : page-load-time \"http://duckduckgo.com\""
exit -11
fi
# note error checking on url is not performed.
# specifiy something that makes sense otherwise the data
# will not make sense
# start the run
while true ; do
CURRENT_TIME=$( date )
PAGE_LOAD_TIME=$( { export TIMEFORMAT='%E' ; time curl "$1" &> /dev/null ; } 2>&1 )
echo " ${PAGE_LOAD_TIME} | ${CURRENT_TIME} "
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment