How to Test Internet Speed on Ubuntu 20.04 with Speedtest-CLI (Step-by-Step Guide)
When working with a server, it’s often necessary to quickly check internet connection speed, bandwidth, and latency. On desktop systems, this can be done using browser-based tools, but on Ubuntu Server 20.04, a command-line solution is required.
In this step-by-step guide, you’ll learn how to test internet speed on Ubuntu 20.04 using Speedtest-CLI, a lightweight command-line tool by Ookla. We’ll cover installation, running speed tests, selecting test servers, and interpreting download and upload results.
Install Speedtest-CLI on Ubuntu 20.04
To test internet speed from the command line, we will install Speedtest CLI by Ookla, the official and most up-to-date command-line tool. This method works well on Ubuntu Server and desktop systems.
Step 1. Update the package index
First, update the local package list to ensure you install the latest available versions:
sudo apt updateStep 2. Install required dependencies
Install curl, which is used to download the official Speedtest repository installation script:
sudo apt install -y curlStep 3. Add the official Speedtest CLI repository
Run the following command to add Ookla’s official repository to your system:
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bashThis script automatically:
- Adds the Speedtest CLI repository
- Imports the repository signing key
- Updates the package index
Step 4. Install Speedtest CLI
Once the repository is added, install the Speedtest CLI package:
sudo apt install speedtestStep 5. Verify the installation
After installation, confirm that Speedtest CLI is installed correctly:
speedtest --versionIf the command returns the version number, Speedtest CLI is ready to use.
Internet connection speed test
To run a simple Internet speed test, run:
speedtest-cliRead 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 -LTo select one of them, enter the following command with the server ID instead of "1111":
speedtest -s 1111To see all available options, enter:
speedtest --helpConclusion
Testing internet speed on Ubuntu 20.04 using Speedtest-CLI is a fast and reliable solution, especially for server environments without a graphical interface. With this tool, you can measure download and upload speeds, monitor latency, and troubleshoot network performance issues.
By selecting specific test servers or automating speed checks, Speedtest-CLI becomes a powerful utility for maintaining optimal bandwidth and connectivity on Ubuntu servers.
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. - Q6: Does Speedtest-CLI consume a lot of traffic?
Yes. Each test transfers tens of megabytes of data, so frequent automated tests should be scheduled carefully on metered connections.
700
300
700
300
700
300