How To Test Internet Speed in Linux Using Terminal or SSH

If you want to check your Internet speed through your terminal this article will guide you an easy way. Most of the time we have to check the download and upload speed of our Linux server through ssh this can be an easy and fast way to test speed. But it’s not just restricted to Linux only! You can install Python on macOS or Windows and can run both scripts to test internet speed from the terminal and DoS.


We have to install the Speedtest-cli package first to use this tool. We’re going to need python.

Installing python

Type the following yum command to install Python on a CentOS/RHEL/Scientific Linux:

sudo yum install python

Type the following dnf command to install Python on a Fedora Linux v22+:

sudo dnf install python


Type the following wget command to grab the client:

wget -O speedtest-cli chmod +x speedtest-cli

Check the Internet speed

After we’re done installing python and successfully downloaded the speedtest-cli python package we can run it.

Simply run the following command:


To see speed values in bytes instead of bits pass the –bytes option:

./speedtest-cli --bytes

To generate and provide a URL to the share results image pass the –share option:

./speedtest-cli --share

Of course, you can combine both options:

./speedtest-cli --share --bytes

Specify a server ID to test against!

First, grab a server list, enter:


To view a server ID, enter:

more speedtest-servers.php

To search a server ID, enter:

grep ‘city-name’ speedtest-servers.php grep ‘country-name’ speedtest-servers.php grep ‘Tampa, FL’ speedtest-servers.php

OR just display a server ID

grep ‘Tampa, FL’ speedtest-servers.php | egrep -o ‘id="[0-9]{4}"’

Sample outputs:

id=“2137” id=“1296”

Next use the server ID 2137:

./speedtest-cli --server 2137

Another command line utility for testing internet speed is Tespeed. This utility tests your download and upload speed using five serves closest to your locations. It is also created using Python and requires Python 2.7 or higher versions to run.

What the script does:

TeSpeed: GitHub - Janhouse/tespeed: Terminal network speed test that uses servers from It uses nearest test server but can also use one manually specified by the user. It should work on Linux/OSX/Windows and anything else that runs Python 2 with Python 2 lxml module.