Command Line Broadband Speed Test

We’re all used to using online broadband speed tests from our desktops to test our internet speeds – but what about from a Linux server without a GUI browser? My favourite tool for this purpose is speedtest-cli.

Installation

Installation is straightforward and is available for all the main distributions. If your system is not listed below, see the manual installation section.

Arch Linux

Installation on Arch Linux is simple. However, you do need to make sure the Community Repository has been enabled.

$ sudo pacman -S speedtest-cli

Debian/Ubuntu

Installation on Ubuntu/Debian is also very simple.

$ sudo apt-get update
$ sudo apt-get install speedtest-cli

Fedora

You can install it on Fedora using dnf. However, if you run CentOS or RHEL, you will need to manually install. See the below section.

$ sudo dnf install speedtest-cli

OpenSuSE

Simply run:

$ sudo zypper install speedtest-cli

Manual Installation

If speedtest-cli is not available for your distribution, as long as you run Python, you should be able to manually download and run the program.

To download.

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

To run the program.

$ python speedtest.py

The below command combines both the above:

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

Alternative

Alternatively, if your distribution is not supported, you can install using pip.

$ pip install --user speedtest-cli

Usage

At its simplest, run the command without any options:

[andy@arch ~]$ speedtest
Retrieving speedtest.net configuration...
Testing from Amazon (54.171.227.132)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Virgin Media Ireland (Dublin) [1.59 km]: 18.496 ms
Testing download speed................................................................................
Download: 542.16 Mbit/s
Testing upload speed................................................................................................
Upload: 610.85 Mbit/s

With the --csv and --json options, you can control the output. The below outputs as CSV.

$ speedtest-cli --csv

The below outputs in JSon format.

$ speedtest-cli --json

Both json and csv outputs can be directed to a file like so.

$ speedtest-cli --csv > speedtest-test.csv

You can append new entries with:

$ speedtest-cli --csv >> speedtest-test.csv

You can use any of the servers made available by speedtest.net. To get a full list, use the --list option.

$ speedtest-cli --list

To limit your search, use grep as follows.

$ speedtest-cli --list | grep -i bracknell
23389) Vodafone UK (Bracknell, United Kingdom) [11.63 km]

Then to use this server, use the above server ID with the --server option.

$ speedtest-cli --server 23389

You can also use the --simple option for a less cluttered output.

[andy@arch ~]$ python speedtest.py --simple
Ping: 9.094 ms
Download: 790.85 Mbit/s
Upload: 176.15 Mbit/s

Sample output

Be the first to comment

Leave a Reply