Last active
February 12, 2025 02:43
-
-
Save henri/7c2243bd9f9bfc25a8321341e4ace6b5 to your computer and use it in GitHub Desktop.
curl cheatsheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# check the total real page load time for a specific page load : | |
TIMEFORMAT='%E' ; time curl https://myserver.com 2> /dev/null >/dev/null | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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