How to Test Internet Speed on Ubuntu 20.04 with Speedtest-CLI: Step-by-Step Guide
A situation often arises when you need to determine the bandwidth of the Internet channel. In the desktop version of the operating system, it is enough to enter the corresponding request into a search engine and measure the speed on any of the search results sites. But if it needs to be done in the server version, the method will be different. In this tutorial, we are going to take a look at how to test Internet connection speed on Ubuntu 20.04. All commands must be run as root.
Install Speedtest
To install Speedtest you need to add its repository. Install the required packages first.
apt install gnupg1 apt-transport-https dirmngr
Add a key for the repository.
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 379CE192D401AB61
Add the repository itself.
echo "deb https://ookla.bintray.com/debian generic main" | sudo tee /etc/apt/sources.list.d/speedtest.list
Uninstall another version of Speedtest, if installed.
apt remove speedtest-cli
Update the packages list.
apt update
Finally, install a tool to test Internet connection speed.
apt install speedtest-cli
Internet connection speed test
To run a simple Internet speed test, run:
speedtest-cli
Read the license and accept it.
Do you accept the license? [type YES to accept]:
You will see the results when the test is complete:
Speedtest by Ookla
Server: Some Server
ISP: Your ISP
Latency: 1.22 ms (0.04 ms jitter)
Download: 82.59 Mbps (data used: 41.5 MB)
Upload: 91.69 Mbps (data used: 41.3 MB)
Packet Loss: 0.0%
Result URL: https://www.speedtest.net/result/c/4f200375-d643-...
You can share the result using the Result URL.
You can choose another server to test the speed. Enter this command to see the nearest servers:
speedtest -L
To select one of them, enter the following command with the server ID instead of "1111":
speedtest -s 1111
To see all available options, enter:
speedtest --help
Conclusion
Testing your Internet connection speed on Ubuntu 20.04 using Speedtest-CLI is a fast and reliable method, especially for server environments where graphical tools are unavailable. By following this guide, you can measure your download and upload speeds, check latency, and even select specific servers for testing. This allows you to monitor your network performance effectively, troubleshoot connectivity issues, and ensure that your server maintains optimal Internet bandwidth.
FAQ
- Q1: Do I need root access to run Speedtest-CLI on Ubuntu 20.04?
Yes, installing and configuring the repository and packages requires root privileges. Running the actual speed test does not strictly require root, but it is recommended to avoid permission issues. - Q2: Can I test my connection with a specific server?
Yes, you can list nearby servers using speedtest -L and then select one using speedtest -s [server ID]. - Q3: How can I share my Speedtest results?
After the test completes, Speedtest-CLI provides a Result URL that you can share to display the detailed results online. - Q4: What if another version of Speedtest is already installed?
It is recommended to uninstall any previous versions using apt remove speedtest-cli to avoid conflicts with the official repository version. - Q5: Can I automate regular speed tests?
Yes, you can create a cron job that runs speedtest-cli at scheduled intervals and logs the results for monitoring network performance over time.


