How to do a Speed Test on Ubuntu/Debian

I’ve always wondered how to do a (somewhat reliable/accurate) speed test from a linux server via command line. In this guide I will walk you through the quick steps of installing a python application that does exactly that using speedtest.net’s services.

The tool we will be using to perform these speed tests is speedtest-cli. All credit goes to Matt Martz who built this powerful little tool.

Prerequisites

Python 2.4-3.4 or above (installation steps are below).

Install Steps

Update your repositories and PPA:

apt-get update

Install the pip package manager:

apt-get install python-pip

Press Y to agree with installation.

Install the application:

sudo -H pip install speedtest-cli

Collecting speedtest-cli
Downloading speedtest_cli-1.0.7-py2.py3-none-any.whl
Installing collected packages: speedtest-cli
Successfully installed speedtest-cli-1.0.7

Run the Speed Test

speedtest-cli

Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by ASK4 (Sheffield) [22.47 km]: 49.193 ms
Testing download speed................................................................................
Download: 73.48 Mbit/s
Testing upload speed................................................................................................
Upload: 18.36 Mbit/s

Run the speed test outputting speed in bytes/s:

speedtest-cli --bytes

Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by ASK4 (Sheffield) [22.47 km]: 28.703 ms
Testing download speed................................................................................
Download: 9.18 Mbyte/s
Testing upload speed................................................................................................
Upload: 2.35 Mbyte/s

Run the speed test outputting a link to share:

speedtest-cli --share

Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by ASK4 (Sheffield) [22.47 km]: 27.717 ms
Testing download speed................................................................................
Download: 73.19 Mbit/s
Testing upload speed................................................................................................
Upload: 18.89 Mbit/s
Share results: http://www.speedtest.net/result/6824450580.png

Summary

As you can see, this is a tool that all system administrators should find useful.

Happy speed testing!

Leave a Reply

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

*