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, but we also have,, … even Google let’s you do it directly from its search page (you have to search using US-based, 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!)

You can download the python script to run the Linux command line interface tool from here (obviously python is a pre-requisite):

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

pip install speedtest-cli

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

usage: speedtest-cli [-h] [--bytes] [--share] [--simple] [--list]
[--server SERVER] [--mini MINI] [--source SOURCE]
[--timeout TIMEOUT] [--secure] [--version]

Command line interface for testing internet bandwidth using

optional arguments:
-h, --help show this help message and exit
--bytes Display values in bytes instead of bits. Does not affect
the image generated by --share
--share Generate and provide a URL to the share
results image
--simple Suppress verbose output, only show basic information
--list Display a list of servers sorted by
--server SERVER Specify a server ID to test against
--mini MINI URL of the Speedtest Mini server
--source SOURCE Source IP address to bind to
--timeout TIMEOUT HTTP timeout in seconds. Default 10
--secure Use HTTPS instead of HTTP when communicating with operated servers
--version Show the version number and exit

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” ):

speedtest-cli --bytes --server 3730


Retrieving configuration...
Retrieving server list...
Testing from Moldtelecom (
Hosted by Virgin Media (Edinburgh) [532.85 km]: 170.272 ms
Testing download speed........................................
Download: 1.92 Mbyte/s
Testing upload speed..................................................
Upload: 0.95 Mbyte/s

And comparing to the web interface we see:

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

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 or just run these commands to download and run once you’re in the folder you want to keep the script in:

wget && chmod u+x



-------------Speed test--------------------
Testing North America locations
Speedtest from Portland, Oregon, USA [ generously donated by ] on a shared 100 Mbps port
Download Speed: .33 MB/sec
Upload speed: .62 MB/sec
Speedtest from Seattle, Washington, USA [ generously donated by ] on on a shared 1 Gbps port
Download Speed: 1.22 MB/sec
Upload speed: .95 MB/sec

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 tends to show much lower speeds than the other tools.

[Note has now been depreciated (the author commented on this post below). You can find his new improved tool at instead.]

Or download and run with:

wget && chmod u+x



:: Rate in Kilobytes/sec; industry usually adopts megabits/sec:
:: 1 Kilobytes/sec (K/s) = 0.007813 megabits/sec (Mbps).
:: To CONVERT, use negated rate as first argument to netspeed.
:: [Terminate netspeed by control-C] [ cf. ]
--2016-08-23 22:16:08--
Resolving (, 2600:3c01::4b
Connecting to (||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: ‘/dev/null’

100%[=====================================================================================================>] 104,857,600 904KB/s in 2m 18s

2016-08-23 22:18:27 (742 KB/s) - ‘/dev/null’ saved [104857600/104857600]

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

1 Comment

  1. Hi ! from the guy who wrote …


    The gist above, **, has been deprecated.

    ## Good news

    Work has shifted to using the infrastructure of and
    again made easily accessible by **Bash shell scripts** for all POSIX and Linux systems.
    Please visit to obtain the code. PR are welcomed!

Leave a Reply

(email optional)