Skip to main content

Test your server’s internet connection with speedtest in command line

We can clearly say that has the supremacy in internet speed tests, with thousands of speedtest servers accross the globe. And actually they give good bandwidth test results!

But you may not find their flash interface very sexy (my case) and if you have a server with no Graphical interface, you cannot use website.

Not a big deal, several scripts exists to let you run a speedtest in command line. It’s the case of Speedtest-cli.

Speedtest-cli, written in Python, is a simple yet complete script to let you perform internet bandwidth speed test on network.

You can also specify the server you want to use, or even to generate a share results image.



Of course, I suppose you already have python installed on your server (Require Python 2.4 and above) and the easiest way to install it will be with pip or easy_install. (pip is a more recent way to install and manage python packages, I recommend you to use this one)

1) Install python-pip (if not done yet)

In root (or with sudo) type:

2) Install the latest speedtest-cli with pip

and….yes that’s all. You can now run speedtest-cli directly from your terminal.


Here are few examples on my 100M/100M@home connection:

– No option:

– With share results image

speedtest cht taiwan 100m

– On targeted server only

Get first the list of servers

Then select the one you want to run the speedtest on (using its id, 4 digits)

I guess it’s time to see which one of us has the biggest….\0/

I don’t doubt you can do better 🙂

3 thoughts on “Test your server’s internet connection with speedtest in command line

  1. Great article thanks. Is there any way to script this to pick the X number of closest test servers and run against all of them, maybe list all results or average the results? We setup new servers in datacenters around the world and need a way to quickly gauge if the hosting provider’s network is any good.

    Selecting best server based on latency…
    Hosted by T-Mobile [37.62 km]: 22.447 ms
    Testing download speed………………………………….
    Download: 460.58 Mbits/s
    Testing upload speed…………………………………………..
    Upload: 93.23 Mbits/s

    Thank you,

    1. Hi Fred,
      Glad you like it.

      Well, the script as itself cannot do such thing….but you can actually retrieve all the servers list, ranked by proximity (Closest to you first).
      Obviously the closest might not means it’s the fastest, but could be.

      So, you could probably run a little script that will:
      1) Run speedtest-cli –list
      2) Get the top 5 server ID
      3) Run 5 speedtest-cli –server xxxxx
      You could even add the option –simple to display only the final result (ping + DL + UP)

      This is what I’m thinking of. May be there is a better way, but this one should be simple.

Leave a Reply

Your email address will not be published. Required fields are marked *