How to test linux server internet speed

Este post também está disponível em: Português (Portuguese (Brazil))

speedtest-cli is a very useful command line tool for SysAdmin or users with shell access to quickly test the download, upload and ping speed of the Linux server.

Below we will cover the installation on CentOS/RedHat , Ubuntu/Debian and the manual way that will work for any other Linux distribution.

CentOS/RedHat

Install the epel release repository

yum install epel-release -y

Install python3 and python3-pip and update pip

yum install python3 python3-pip -y
pip3 install --upgrade pip3

Install speedtest-cli with pip3

pip3 install speedtest-cli

Ubuntu

Update server packages

apt update
apt upgrade -y

Install python3 , python3-pip and update pip3

apt-get install python3 python3-pip
pip3 install --upgrade pip3

Install speedtest-cli with pip3

pip3 install speedtest-cli

Other Linux/UNIX distributions

Make sure python3 is installed on your server

Download speedtest-cli

wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py

Change file permissions for execution

chmod +x speedtest-cli

Note: Some firewalls may prevent the test from working properly by generating a “0 Mbps” download/upload result.

Example commands for speedtest-cli

Run the command below to start the speed test

speedtest-cli

Example of result

[root@helpsysadmin ~]# speedtest-cli
Retrieving speedtest.net configuration...
Testing from Choopa, LLC (xxx.xxx.xx.xx)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by UPX Technologies (Miami, FL) [2.79 km]: 1.777 ms
Testing download speed................................................................................
Download: 275.07 Mbit/s
Testing upload speed................................................................................................
Upload: 406.27 Mbit/s

To run the test and generate the Speedtest link with the result:

speedtest-cli --share
[root@helpsysadmin ~]# speedtest-cli --share
Retrieving speedtest.net configuration...
Testing from Choopa, LLC (xxx.xxx.xx.xx)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Grupo GTD (Miami, FL) [2.79 km]: 1.251 ms
Testing download speed................................................................................
Download: 3185.75 Mbit/s
Testing upload speed................................................................................................
Upload: 2603.02 Mbit/s
Share results: http://www.speedtest.net/result/10619675862.png

Below is an example of the result


Need some assistance on your Server? We can help you!