HowTo: TEST Internet Speed via Linux Command Line

If you need to troubleshoot an issue with slow Internet access on your Linux system, it would be a good idea to measure the current Internet speed.

In this article you’ll find how to test Internet speed from the Linux terminal, using speedtest_cli – a simple command-line client written in Python for measuring Internet bandwidth by using Speedtest.net infrastructure.

I’ll show how to simply check download/upload Internet speed to the geographically closest server, how to measure the network speed to specific server and how to share the results of speed test via Speedtest.net.

All these tasks can be performed using the Linux command line only.

Test Download/Upload Internet Speed in Linux

Use the following command to Test Internet Download and Upload Speed from the Linux Command Line:

$ wget -O - https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python

Sample output:

Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from ******* (xxx.xxx.xxx.xxx)...
Selecting best server based on latency...
Hosted by ******* [1.24 km]: 2.458 ms
Testing download speed...
Download: 84.35 Mbits/s
Testing upload speed...
Upload: 77.32 Mbits/s

Test Internet Speed From the Linux Command Line

If you are planing to measure Internet bandwidth often, you can install speedtest script on your system:

$ wget https://raw.github.com/sivel/speedtest-cli/master/speedtest.py
$ chmod a+rx speedtest.py
$ sudo mv speedtest.py /usr/local/bin/speedtest
$ sudo chown root:root /usr/local/bin/speedtest

After installation, you will be able to test Internet speed from the terminal by simply running speedtest command, as follows:

$ speedtest
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from ******* (xxx.xxx.xxx.xxx)...
Selecting best server based on latency...
Hosted by ******* [1.24 km]: 2.458 ms
Testing download speed...
Download: 84.35 Mbits/s
Testing upload speed...
Upload: 77.32 Mbits/s

Share the Result Of Speed Test via Speedtest.net

If you want to share the result of speed test, run speedtest command, as follows:

$ speedtest --share
Share results: http://www.speedtest.net/result/3690948322.png

Get the List Of Available Speedtest.net Servers

Run the following command to get the list of all available Speedtest.net servers around the world:

$ speedtest --list | more
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
3464) Vodafone España (Alicante, Spain) [3047.78 km]
 804) ServiHosting Networks (Elda, Spain) [3063.22 km]
4845) du (Dubai, United Arab Emirates) [3069.72 km]
4844) Etisalat (Dubai, United Arab Emirates) [3069.72 km]

Measure the Network Speed to Specific Server

You can manually specify server ID during testing, instead of using the geographically closest one.

Let’s test the link to “1746) Vodafone DE (Frankfurt, Germany) [1937.90 km]”:

$ speedtest --server 1746
Was it useful? Share this post with the world!

5 Replies to “HowTo: TEST Internet Speed via Linux Command Line”

  1. The file speedtest_cli.py has been deprecated in favor of speedtest.py
    what happen in this file ?

    1. Thanks for information. I’ve update the URL.

    2. $ wget https://raw.github.com/sivel/speedtest-cli/master/speedtest.py
      $ chmod a+rx speedtest.py
      $ sudo mv speedtest.py /usr/local/bin/speedtest
      $ sudo chown root:root /usr/local/bin/speedtest
      
      1. Updated again. Thanks.

  2. questionmax says: Reply

    How to test upload speed without python (telnet to router) ?

Leave a Reply