Speedtest CLI on Ubuntu [How To Install]

In this tutorial, we learn how to install and use Speedtest CLI on Ubuntu. Running speedtest CLI can be beneficial in the hosting environment to check whether the provided bandwidth is as advertised.

Overview

In this tutorial, we learn how to install and use Speedtest CLI on Ubuntu. Running speedtest CLI can be beneficial in the hosting environment to check whether the provided bandwidth is as advertised.

Speedtest CLI can also be used to check our own internet connection. Running from command line should provide better test compared to browser based test since command line will have cleaner test environment, for example no browser plugins.

We will install the official speedtest command line application provided by ookla.

Add Speedtest CLI repository

curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash

The output for the command above will be similar to output below.

Detected operating system as Ubuntu/focal.
Checking for curl...
Detected curl...
Checking for gpg...
Detected gpg...
Running apt-get update... done.
Installing apt-transport-https... done.
Installing /etc/apt/sources.list.d/ookla_speedtest-cli.list...done.
Importing packagecloud gpg key... done.
Running apt-get update... done.

The repository is setup! You can now install packages.

The script will do the following operations for us:

  • Detect operating systems version.
  • Check for the availability of certain tools (curl and gpg).
  • Install apt-transport-https package to enable apt download packages from package repository using https.
  • Create new repository configuration in /etc/apt/sources.list.d/ookla_speedtest-cli.list
  • Import packagecloud gpg key. This key will be used by apt to verify that the package being downloaded is the correct package created and signed by packagecloud.
  • Running apt-get update command to refresh apt package index.

Install Speedtest CLI on Ubuntu

Now the repository configuration is ready, we can install speedtest CLI on Ubuntu using the following command.

sudo apt-get install speedtest

Run Speedtest CLI

We can run speedtest without using any options or parameters

speedtest

Speedtest CLI will choose the closest speedtest server and start. On the first run, we have to accept EULA, terms and privacy policy.

speedtest cli ubuntu

List Speedtest Command Options

To list speedtest CLI options we can use the --help option.

speedtest --help

Listing Speedtest Servers

To get list of closest speedtest servers we can use -L options

speedtest -L

speedtest cli Ubuntu - listing speedtest servers

Run Speedtest From Specific Server

From the output of the command above where we get a list of closest speedtest servers, copy the ID of the server that we want to use.

For example, to run the speedtest against server 14276 we can use the command below.

speedtest -s 14276

Video Tutorial

Summary

In this tutorial, we learn how to install and run Speedtest CLI on Ubuntu. We also learn how to get a list of the closest Speedtest servers and run speedtest from a specific server.