Speedtest CLI - How to diagnose slow upload speeds on Ubuntu Server 18.04?

If you are running Ubuntu Server 18.04 and trying to test upload/download speed using Speedtest by Ookla, you may find upload speed never going above 4 Mbits/s, despite every other machine with other OS in the same network getting speeds around 300-400 Mbits/s or more when performing speed tests from the same tool.


We tried investigating server settings, tuning in the network and kernel settings but we were not able to achieve any progress.


After several attempts, we were able to find out that the issue was with speedtest-cli tool. And the same issue is confirmed by ubuntu bug reporting that speedtest-cli version 2.0.0 is indeed broken for upload speeds. This bug version is getting installed in the server by using the official repository from ubuntu 18.04.


You can install the speedtest-cli tools using two methods instead of an apt method to have the latest bug-free version. The first method includes the use of python-pip package manager, the second method is to download the Python script manually, make it executable and then run the application.


Method 1: Installing speedtest-cli using python-pip

1. The first step is to make sure your list of packages from all Ubuntu repositories and PPA’s is up to date by running the following command:


# apt-get update


2. Next step is to install the pip package manager on your system. 

# apt-get install python-pip


3. After installing the package, you can install the speedtest application using this pip command:

#pip install speedtest-cli


4. If you want to upgrade the speedtest-cli application in the future, you can use this command:

#pip install speedtest-cli –-upgrade


Method 2: Installing the latest speedtest-cli manually from GitHub


1. First of all, you have to download the python script from GitHub using the command

#cd /tmp

#wget https://github.com/sivel/speedtest-cli/archive/master.zip


2. The second step is to unpack the file that you have downloaded (master.zip) and extract it using the unzip command:

#unzip master.zip


3. When you have extracted the file, make the extracted script executable by going to the extracted directory and using the chown command.

#cd speedtest-cli-master/


#chmod 755 speedtest.py


4. To avoid typing the full path every time, move the executable file to /usr/local/bin by using the following command:

# mv speedtest.py /usr/local/bin/speedtest-cli


How to test internet connection speed with speedtest-cli?




# speedtest-cli –share


You can also check the list of servers based on the distance (in km) by using the following command:

#speedtest-cli –list


By searching the list in terms of distance, you will get a big list of the servers. 

If you want to check the result for servers in a specific area, then you can check that by piping the result to the grep command (India is an example of the area):

#speedtest-cli –list | grep India


To test the connection speed against a specific server, you have to use the server ID generated in speedtest-cli –list | grep India

speedtest-cli –server [server ID]

#speedtest-cli –server 49756


Here server ID 19082 belongs to Airtel Broadband (Delhi, India) is used as an example:



We saw that this updated latest version of speedtest-cli can be used to test internet speed in Ubuntu 18.04 server from the terminal and you will get actual upload speed of the server.


To try our Public Cloud servers, check the link below:




Article Details

Article ID:
Rating :