Internet speedtest from Linux command line

There are lots of online tools for checking your ISP provided internet speed. Most are web based interfaces and there are some great ones out there. The most popular is probably www.speedtest.net, but we also have www.fast.com, www.speedof.me, … even Google let’s you do it directly from its search page (you have to search using US-based google.com, not any of Google’s other country TLDs).

You can also do it from the Linux command line using a few open source tools. Here is how to do it…

(Note that all my speeds are low here since I’m downloading in the background!)


Speedtest.net

You can download the python script to run the speedtest.net Linux command line interface tool from here (obviously python is a pre-requisite):
https://github.com/sivel/speedtest-cli

You can install using git, pip/easy-install or download with wget. I’m going to use pip

Typing  speedtest-cli --help  shows you this output listing all available options:

I’ve found the best way to run this is to use the bytes option, and pick a server relatively local (you can find the available servers by running speedtest-cli --list , probably worth grepping to narrow it down to your country, speedtest-cli --list | grep "Great Britain" ):

Returns:

And comparing to the web interface we see:

speedtest

Remember 1 megabyte per second = 8 megabits per second, and the web interface returns results in megabits per second.


speedtest.sh

If you don’t have python installed you can use the script below which is entirely written in bash. This could be useful for running on some internet-of-things devices which have telnet or SSH but don’t have python installed. Or to run on some routers (e.g. DD-WRT or Tomato) which you can SSH into but may not have python installed.

Download from http://dl.getipaddr.net/ or just run these commands to download and run once you’re in the folder you want to keep the script in:

Returns:

This script will keep looping through different servers until you cancel it (Ctrl+C), at least I’ve never been patient enough to let it go long enough to finish on its own!

I’ve found that speedtest.sh tends to show much lower speeds than the other tools.


netspeed.sh

This is another bash script which can be found here: https://gist.github.com/rsvp/1272488

Or download and run with:

Returns:



All credit to this Hak5 youtube video. They go into a lot more detail on this stuff in the video.

1 Comment

  1. Wow. That is so elegant and logical and clearly explained. Brilliantly goes through what could be a complex process and makes it obvious.

Leave a Reply

(email optional)