HostOnNet Blog

Check Internet speed from the command line on Linux

Looking for Linux Server Admin or WordPress Expert? We can help.

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

Underneath it, Speedtest.net loads JavaScript code in your web browser, which then automatically detects the closest Speedtest.net server from you, and measures download/upload speed by sending HTTP GET and POST requests to the server.

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.4. Installing the latest speedtest-cli is nothing more than downloading the Python script.

Run below commands in terminal

wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
chmod a+rx speedtest_cli.py
sudo mv speedtest_cli.py /usr/local/bin/speedtest-cli
sudo 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 its job done.

speedtest-cli

This will show you below result:
speed_test_3

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 “–share” option, which will allow you to share speed test result with others in an image format via Speedtest.net.

speedtest-cli --share

This will show you below result:
speed_test_2

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

speed_test_4

About Vineesh Mohan

A Technical Support specialist with strong customer service and good communication skills. I live in the city of Cochin, which known as the Queen of Arabian Sea.
Posted in General, Linux. Bookmark the permalink.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.