Informational Website publish

Blog

News about our company, tutorials about IT and much more you will find in this page.

Test Internet Connection Speed with Speedtest on Linux

Março 30th, 2018

When you are experiencing slow Internet access, you may want to test the Internet speed of your computer as part of the troubleshooting. For that matter, Speedtest.net is probably the most widely used broadband speed testing website.

However, if you are trying to check Internet speed from a remote headless server, VPS or an otherwise desktop-less system, Speedtest.net’s Flash-based user-friendly interface would be no good. For those of you, there is a command-line interface (CLI) version of Speedtest.net, known as speedtest-cli. Here I will demonstrate how to use speedtest-cli to check Internet speed from the command line in Linux.

Install speedtest-cli on Linux

speedtest-cli is a simple CLI client written in Python for measuring bidirectional Internet bandwidth by using Speedtest.net infrastructure. It works with Python 2.4-3.7. Installing the latest speedtest-cli is nothing more than downloading the Python script.

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

Test Internet Connection Speed with speedtest-cli

It is straightforward to check your Internet speed with speedtest-cli. Running speedtest-cli command without any argument gets the job done.

speedtest-cli

This will automatically discover the closest Speedtest.net server (in terms of geographic distance), and report download and upload speed measured from the server.

If you want to share the speed test result, you can use the “–share” option, which will allow you to share the speed test result with others in an image format via Speedtest.net.

The following is a sample image automatically generated and uploaded to Speedtest.net by speedtest-cli.

If you want to get a list of available Speedtest.net servers around the world, use the “–list” option. It will display a sorted list of Speedtest.net servers (geographically closest ones first).

In the server list shown above, each Speedtest.net server shows an associated server ID in front. You can manually specify the server ID during testing, instead of using the geographically closest server. For example, if you want to use a specific location, use the “–server” option with the corresponding server ID (e.g., 6061).

speedtest-cli --server 6061

Note: Do not run any aggressive cron job! speedtest-cli is an unofficial third-party tool which is meant for residential users who want to check their broadband speed. You are NOT supposed to run any aggressive script with it, bombarding the Speedtest.net’s infrastructure which is shared with many others!