How to do a speed test from the Linux command line interface (CLI)

Doing a speed test from the command line can be really useful, especially if you’re going to script it for regular performance metrics from the server’s point of view. This is really useful if you want to see if your hosted server is still performing as what it should.

We present a few methods for doing a speed test here.

The company that provides the Speedtest.net service has a command line utility called `speedtest-cli` that allows one to run a speed test. Here are instructions on installing and using this utility on both Ubuntu Linux and CentOS.

Speedtest Quick and Easy without Root

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

Speedtest CLI on Ubuntu

Speedtest-cli uses Python but is already pre-packaged on Ubuntu, so just do:

sudo apt install speedtest-cli

Then:

speedtest-cli

The utility will automatically pick the closest Speedtest.net server and do a speed test. To see a list of servers available, do:

speedtest-cli --list
speedtest-cli --list | grep africa

This will output a numeric next to the name of the Speedtest server, e.g. 14406.

Then do:

speedtest-cli --server 14406

In our experience the utility is fairly accurate in describing download speeds, but completely inaccurate in describing upload speeds

Speedtest CLI on CentOS

Unfortunately getting speedtest-cli working on CentOS is as easy as Ubuntu as there is no package for it. However, you could try the following instructions. These instructions depend on Python being installed on your computer. To confirm that Python version 2 is installed, do python --version , or do python3 --version to see if Python version 3 is installed.

wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli 
./speedtest-cli

Other browser based speed test servers

References

 

Share this article

Leave a Reply

Your email address will not be published.

Scroll to Top