Skip to content

Instantly share code, notes, and snippets.

@joseluisq
Last active February 17, 2020 14:22
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 joseluisq/cdbaff8e79f31b7eeaec25d8679ec5dc to your computer and use it in GitHub Desktop.
Save joseluisq/cdbaff8e79f31b7eeaec25d8679ec5dc to your computer and use it in GitHub Desktop.
Testing download file speed using cUrl and get its stats into a log file. Unix-like systems only.
#!/bin/bash
# For customize the writeout take a look at https://ec.haxx.se/usingcurl/usingcurl-verbose/usingcurl-writeout
curl -Skw "\
CURL download file testing\n\
==========================\n\
URL: %{url_effective}\n\
Response code: %{response_code}\n\
Download size: %{size_download}B\n\
Download speed: %{speed_download}B/s\n\
Time connect: %{time_connect}s\n\
Time name lookup: %{time_namelookup}s\n\
Time pretransfer: %{time_pretransfer}\n\
Time start transfer: %{time_starttransfer}s\n\
Time redirect: %{time_redirect}s\n\
Time total: %{time_total}s\n" \
-Lo /dev/null \
--url $1 \
> download_testing_stats.log
@joseluisq
Copy link
Author

joseluisq commented Feb 17, 2020

Script usage

Downloaded stats content will be placed into a download_testing_stats.log.

chmod +x download_testing_stats.sh
./download_testing_stats.sh "https://ger.mirror.pkgbuild.com/iso/2020.02.01/archlinux-2020.02.01-x86_64.iso"

Note:

  • The script support an URL as parameter.
  • The script doesn't save any file locally. For get the file into a specific location just replace /dev/null with the corresponding file path on system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment