Performing network speedtest on servers or on desktops are one of the common tasks that are performed almost on regular basis (Learn more about networking). Most of the speed tests require a GUI to run but what about the servers that don’t actually have gui installed. For running speedtest on Linux CLI, we can use an utility named Speedtest-cli.

Speedtest-cli is basically a Python script that can be used to measure the internet speed. In this tutorial, we are going to learn how to check internet speed from CLI using speedtest-cli from Linux machines. So let’s start with pre-requisites to install speedtest-cli,

(Recommended Read: Managing network connections using IFCONFIG & NMCLI commands)

(Also Read: Monitoring network bandwidth with iftop command)

 

Pre-requisites

1- As mentioned, Speedtest-cli is python based script & requires that we have Python 2.4 to Python 3.5 version installed on systems. Python is pre-installed almost on all Linux distributions, if not than install it using the following commands,

CentOS/RHEL

$ yum install python

Ubuntu/Debian

$ sudo apt-get install python

Fedora

$ dnf install python

2- Secondly we need to have pip installed on our machine. Read our detailed article on 'how to install PIP on lInux machines’ to install pip.

Now there are two ways with which we can run the speedtest on Linux CLI, i.e. either we download the script & run it to measure the internet speed or we can also install the speedtest-cli utility on the system & run it like a normal command.

 

Running speedtest-cli script

For this method to work, we only need to download the speedtest-cli script on our Python installed system. Download the script using the following command,

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

& than provide it the permissions to execute,

$ chmod +x speedtest-cli

Now all we need to do to get the internet speed is to execute the script using any of the below mentioned command,

$ ./speedtest-cli

Or

$ python speedtest-cli

speedtest on Linux CLI

 

Installing Speedtest-cli utility

To install speedtest-cli onto our system, we will use PIP. Execute the following command to install speedtest-cli ,

$ pip install speedtest-cli

Or we can also use it’s github repository for installation,

$ pip install git+https://github.com/sivel/speedtest-cli.git

This will install the speedtest-cli utility onto our Linux systems. Now we can run it a normal command. Run the following command to get all the options that can be used with speedtest-cli,

$ speedtest-cli –h

speedtest on Linux CLI

This completes our tutorial on how to run speedtest on Linux CLI using speedtest-cli. Please do leave any questions or suggestions that you guys have , using the comment box below.

If you think we have helped you or just want to support us, please consider these :-

Connect to us: Facebook | Twitter | Google Plus

Donate us some of you hard earned money: [paypal-donation]

Linux TechLab is thankful for your continued support.