How To'sLinuxMacOSWindows

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 our 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 in MacOS or Windows and can run these both scripts to test internet speed from terminal and DoS.


We have to install 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 speedtest-cli python package we can run it.

Simply run this 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 the 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
<server url="" lat="27.9709" lon="-82.4646" name="Tampa, FL" country="United States" cc="US" sponsor="Hivelocity Hosting" id="2137"  host="" />
<server url="" lat="27.9709" lon="-82.4646" name="Tampa, FL" country="United States" cc="US" sponsor="Rapid Systems" id="1296"  host="" />

OR just display a server ID:

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

Sample outputs:


Next use the server ID 2137:

./speedtest-cli --server 2137

Another command line utility for testing internet speed is Tespeed. This utlity 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:

  • Loads config from (
  • Gets server list (
  • Picks 5 closests servers using the coordinates provides by config and serverlist.
  • Checks latency for those servers and picks one with the lowest.
  • Does download speed test and returns results.
  • Does upload speed test and returns results.
  • Optionally can return CSV formated results.
  • Can measure through SOCKS proxy.


Alternative speed test with

Noor Qureshi

Experienced Founder with a demonstrated history of working in the computer software industry. Skilled in Network Security and Information Security.

Related Articles

Back to top button