Often you want to test your Linux server’s throughput against other nodes on the speedtest.net network. This is especially useful when we have access to our server via SSH and do not want to get a web-based application involved.

It is important to note that your test results will vary greatly depending on many factors outside of your server provider’s control. Throughput will be impacted by the network port capacity of the server, traffic levels of other applications and efficiency of the intermediary networks to the destination server. These measurements, provided in conjunction with other servers on the speedtest.net network, are not the most reliable mechanisms to test network throughput and should not be taken as absolute indicators of network performance. Other, specialized tools like iperf, ping, traceroute should be used for network troubleshooting.

The speedtest-cli application is written in Python. Therefore, we must make sure Python is installed and working properly by issuing the following commands:

python --version
python3 --version

 

First: Install Python

You can install Python by issuing the following commands on a CentOS/RHEL/Scientific Linux server:

$ sudo yum install python

If you are using a newer distribution of a RHEL-based OS, like CentOS 8, use the following commands to install Python 2 or 3:

$ sudo yum install python3
$ sudo yum install python2


In case of newer Debian-based systems, you can run the dnf command to install Python:

$ sudo dnf install python
$ sudo dnf install pytho3


Second: Download speedtest_cli.py

Use the wget command to download the speedtest_cli.py client, as follows:

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

Set execute permissions to the script:

$ chmod +x speedtest-cli


Third: Run the internet speed test

To run the test against the closest server, based on ping results, to the speedtest.net network, type the following command:

$ ./speedtest-cli


Or, as an alternative, you can execute the Python command:

$ python speedtest-cli


You will see the results like in the following outputs:

$ ./speedtest-cli
Retrieving speedtest.net configuration...
Testing from Velocihost (192.171.18.189)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Hivelocity (Miami, FL) [2.29 km]: 8.155 ms
Testing download speed.............................................................................
Download: 930.82 Mbit/s
Testing upload speed...............................................................................
Upload: 897.62 Mbit/s


If you want to see data transfer values in bytes instead of bits pass the --bytes option:

$ ./speedtest-cli --bytes

If you need to generate a URL to the speedtest.net results you should pass the --share option:

$ ./speedtest-cli --share


Additionally, you can use both options on the same command:

$ ./speedtest-cli --share --bytes
Was this answer helpful? 0 Users Found This Useful (0 Votes)