The script tests download of 5MB file and upload of 1MB file using speed.cloudflare.com.
#!/bin/sh
set -e
curl -L -o /dev/null -s -w \
'Download: %{speed_download} B/s' \
'https://speed.cloudflare.com/__down?bytes=5000000' |
awk '/^Download:/ { printf "Download (5MB): %.2f Mbit/s\n", $2 * 8 / 1000000; next } { print }'
dd if=/dev/zero bs=1000000 count=10 2>/dev/null |
curl -sS -o /dev/null -w 'Upload: %{speed_upload} B/s' \
--data-binary @- https://speed.cloudflare.com/__up |
awk '/^Upload:/ { printf "Upload (1MB): %.2f Mbit/s\n", $2 * 8 / 1000000; next } { print }'