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 (
apt-transport-httpspackage to enable apt download packages from package repository using https.
- Create new repository configuration in
- 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.
apt-get updatecommand 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
List Speedtest Command Options
To list speedtest CLI options we can use the
Listing Speedtest Servers
To get list of closest speedtest servers we can use
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.
We can run the following command to run speedtest from spesific server.
speedtest -s <server_id>
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.