Posted In DigitalOcean

Record Speedtest.net Results From the Command Line

For those who live in the command line as much as possible

Install speedtest-cli

speedtest-cli is a Python app that provides a command line interface for testing bandwidth using speedtest.net. Installation is simple. It should work on Linux and OS X.

The Bash Scripts

There’s two scripts, speedtest.sh and speedtest-simple.sh. Pretty self-explanatory. Results from speedtest.sh are stored in st_results in the current working directory. speedtest-simple.sh results are stored in st_results_simple, also in the current working directory.

speedtest.sh Results

Below are the results of two speedtests run with speedtest.sh, along with the sharing image URL.

Retrieving speedtest.net configuration…
Retrieving speedtest.net server list…
Testing from Mediacom Communications (173.22.40.33)…
Selecting best server based on ping…
Hosted by CHRJO (Council Bluffs, IA) [204.50 km]: 20.981 ms
Testing download speed………………………………….
Download: 32.44 Mbit/s
Testing upload speed…………………………………………..
Upload: 5.57 Mbit/s
Share results: http://www.speedtest.net/result/3335225265.png .
#############

Retrieving speedtest.net configuration…
Retrieving speedtest.net server list…
Testing from Mediacom Communications (173.22.40.33)…
Selecting best server based on ping…
Hosted by American Broadband (Blair, NE) [213.79 km]: 20.981 ms
Testing download speed………………………………….
Download: 33.03 Mbit/s
Testing upload speed…………………………………………..
Upload: 5.49 Mbit/s
Share results: http://www.speedtest.net/result/3335230578.png .
#############

You can get less verbose output by modifying the speedtest-cli flags. speedtest-cli --simple --share will produce very simple results that are a bit easier to read. Two tests with the speedtest-simple.sh script are below. Note the absolute crap speeds. Wonderful hotel wi-fi, hah!

speedtest-simple.sh Results

Ping: 13.351 ms
Download: 1.92 Mbit/s
Upload: 0.94 Mbit/s
Share results: http://www.speedtest.net/result/3342143070.png .
#############

Ping: 13.431 ms
Download: 1.80 Mbit/s
Upload: 0.93 Mbit/s
Share results: http://www.speedtest.net/result/3342149985.png .
#############

It’s a very, very simple way of logging the speedtest.net results, but it’ll do for most situations. When I get some free time this week, I’m going to combine speedtest.sh and speedtest-simple.sh and make it accept a --simple argument to generate the simple log.

After that’s done, I’ll be dropping the results into a SQLite database. I’ve gotten pretty familiar with SQLite lately, so it shouldn’t be too difficult.

Once this stuff is logging to a SQLite databse, I’ll put it up on GitHub, I can’t be the only one who would love to run SQL queries against this sort of personalized bandwidth data.

Update April 19, 2014: Updated the code in the GitHub Gist to include the date and time of the speedtest.

Well, now what?

Work with Me

I'm available for hire and always taking new clients, big and small. Got a project or an idea you'd like to discuss? Startup plan but no developer to make it happen? Just get in touch, I'd love to see if I can help you out!

Leave some Feedback

Got a question or some updated information releavant to this post? Please, leave a comment! The comments are a great way to get help, I read them all and reply to nearly every comment. Let's talk. :)

Longren.io is proudly hosted by DigitalOcean

DigitalOcean
Advertisements
  • Manil Trivedi

    Hi Tyler, how would you go about doing this for windows? I would like to record the results of the speedtest-cli call