The Linux system provides a very useful tool for checking the internet speed of your internet connection through a python-based CLI tool known as 'Speedtest-cli'.
Speedtest utility is so helpful for testing real-time internet speed. Most of the users prefer to solve their problems through the command line environment on Linux distribution.
Therefore, the Speedtest is a command-line tool that allows users to conveniently test the internet speed via the terminal.
Here at LinuxAPT, as part of our Server Management Services, we regularly perform several Server Monitoring tasks and queries on CentOS System.
In this context, we shall look into how to install the Speedtest CLI tool on CentOS 8 and using Speedtest utility how to check internet speed via terminal.
The Speedtest-cli is a python-based utility that is written in the python language.
So, to install the Speedtest-cli utility make sure that python should be installed on your system before.
Check the installed python version on your CentOS 8 system by executing the below-mentioned command:
$ python --version
The installed version should display in the output. Otherwise, it will give you an error.
If python is installed then, move further on to the installation of the Speedtest-cli tool.
In our case, python is already installed on this system.
This is a required step for the successful installation of the Speedtest-cli tool on your system. First, we will need to install python on our CentOS 8 system if it is not already installed.
Type the below-mentioned command for python installation on CentOS 8:
$ sudo yum install python3-pip
Now, you can install the speedtest-cli utility on your system through two different methods.
1. Install speedtest-cli utility using the python-pip tool
2. Manually download and install Speedtest-cli.py script
The Speedtest-cli utility can be installed directly on your CentOS 8 system through the python-pip tool by using the following command:
$ sudo pip3 install speedtest-cli
Once the installation of the speedtest-cli utility is completed, execute the following command to test your internet speed:
$ speedtest-cli
To check the internet speed through this method, you need to perform the following steps:
i. Download speedtest.py script
Download the speedtest.py script file by using the 'wget' command:
$ wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
ii. Make executable
Once the above speedtest.py file is downloaded, issue the following command to make this file executable:
$ chmod +x speedtest-cli
iii. Internet speed test through speedtest-cli utility
Now, check the internet speed through the speedtest utility by using the following command:
$ ./speedtest-cli
By default, it shows the internet speed in bits. But, to display the internet speed in bytes, use the command which is given below:
$ ./speedtest-cli --bytes
iv. Generate URL to share speed test results
If you want to share your internet speed test result with someone then, type the following command:
$ ./speedtest-cli --share
The above command will generate a URL.
Copy this Url and paste in a web browser.
Similarly, to generate URL in bytes type the following command:
$ ./speedtest-cli --share --bytes
This article covers the different methods through which you can install the Speedtest utility on your CentOS 8 system.
Also, we have also shown how to test the internet speed through the Speedtest-cli utility and how to generate URLs to share with others.
To Install Speedtest-cli on CentOS 8:
1. Open the terminal to make sure that Python is installed and working properly. Type the following command to check Python version:
$ python --version
If python is not installed on your system then first you will install python on your system.
For this purpose, you need to run the below-mentioned command on the terminal to install python on CentOS 8.
$ sudo yum install python2
2. Download the speedtest_cli.py file using 'wget' command:
$ wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
After successfully saved the downloaded file, you will type the following command on the terminal:
$ chmod +x speedtest-cli