How to run Internet speed tests via command line

Case

You need to run the Ookla Speed Test (https://speedtest.net) inside your software applications via command line interface.

Solution

You can download and install the CLI version of Ookla speedtest at https://www.speedtest.net/apps/cli.

With Speedtest CLI, you can easily:

  • Measure internet connection performance metrics like download, upload, latency and packet loss natively without relying on a web browser
  • Test the internet connection of your Linux desktop, a remote server or even lower-powered devices such as the Raspberry Pi® with the Speedtest Server Network™
  • Set up automated scripts to collect connection performance data, including trends over time
  • Use Speedtest in your programs by wrapping it in the programming language of your choice
  • View test results via CSV, JSONL or JSON

Follow the commands below to install on an Ubuntu Linux machine.

## If migrating from prior bintray install instructions please first...
# sudo rm /etc/apt/sources.list.d/speedtest.list
# sudo apt-get update
# sudo apt-get remove speedtest
## Other non-official binaries will conflict with Speedtest CLI
# Example how to remove using apt-get
# sudo apt-get remove speedtest-cli
sudo apt-get install curl
curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
sudo apt-get install speedtest-cli

Running the speed test command without parameters will invoke the standard speed test as shown below.

Detailed documentation and list of command parameters can be provided by running the speedtest –help command.

Alternative speed test networks/apps are the following:

Was this article helpful?

Related Articles