Speedtest CLI on Ubuntu [How To Install]
Posted on May 30, 2021 (Last modified on July 14, 2022) • 3 min read • 453 wordsIn 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.
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.
curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
```bash
The output for the command above will be similar to output below.
```bash
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:
curl
and gpg
).apt-transport-https
package to enable apt download packages from package repository using https./etc/apt/sources.list.d/ookla_speedtest-cli.list
apt-get update
command to refresh apt package index.Now the repository configuration is ready, we can install speedtest CLI on Ubuntu using the following command.
sudo apt-get install speedtest
```bash
## Run Speedtest CLI {#run-speedtest-cli}
We can run speedtest without using any options or parameters
```bash
speedtest
Speedtest CLI will choose the closest speedtest server and start. On the first run, we have to accept EULA, terms and privacy policy.
To list speedtest CLI options we can use the --help
option.
speedtest --help
```bash
<figure class="wp-block-image size-large is-style-default">
<img loading="lazy" width="750" height="400" src="https://www.howtodojo.com/wp-content/uploads/2021/05/speedtest-cli-ubuntu-6-750x400.png" alt="" class="wp-image-2721" />
</figure>
## Listing Speedtest Servers {#listing-speedtest-servers}
To get list of closest speedtest servers we can use `-L` options
```bash
speedtest -L
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
```bash
<figure class="wp-block-image is-style-default">
<img loading="lazy" width="750" height="337" src="https://www.howtodojo.com/wp-content/uploads/2021/05/speedtest-cli-ubuntu-4-750x337.png" alt="" class="wp-image-2723" /> </figure>
## Video Tutorial {#video-tutorial}
## Summary {#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.