Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | Yes |
Requirements | Linux with Python |
Est. reading time | 3 minutes |
Install Speedtest-cli on a Linux
The speedtest-cli written in Python. So make sure Python installed and working correctly. Here is how to find out Python version:
python --version
python3 --version
lsb_release -a
Step 1: Install python
Type the following yum command to install Python on a CentOS/RHEL/Scientific Linux:
$ sudo yum install python
CentOS / RHEL 8 user type the following command to install Python 3 or 2:
$ sudo yum install python3
$ sudo yum install python2
Run the following dnf command to install Python on a Fedora Linux v22+:
$ sudo dnf install python
$ sudo dnf install python3
Step 2: Download speedtest_cli.py
Type the following wget command to grab the speedtest_cli.py client:
$ wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
$ chmod +x speedtest-cli
Step 3: Check the Internet speed
Simply type the following command:
$ ./speedtest-cli
OR
$ python speedtest-cli
Sample outputs:
Retrieving speedtest.net configuration... Retrieving speedtest.net server list... Testing from nixcraft Dutch Holdings BV (5.151.xx.yyy)... Selecting best server based on latency... Hosted by SoftLayer Technologies, Inc. (Amsterdam) [6.45 km]: 2.317 ms Testing download speed........................................ Download: 925.88 Mbit/s Testing upload speed.................................................. Upload: 105.69 Mbit/s
To see speed values in bytes instead of bits pass the --bytes option:
$ ./speedtest-cli --bytes
To generate and provide a URL to the speedtest.net share results image pass the --share option:
$ ./speedtest-cli --share
Of course, you can combine both the options:
$ ./speedtest-cli --share --bytes
Sample outputs:
How do I specify a server ID to test against?
First, grab a server list, enter:
$ wget http://www.speedtest.net/speedtest-servers.php
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="http://speedtest1.hivelocity.net/speedtest/upload.php" lat="27.9709" lon="-82.4646" name="Tampa, FL" country="United States" cc="US" sponsor="Hivelocity Hosting" id="2137" host="speedtest1.hivelocity.net:8080" /> <server url="http://speedtestnet.rapidsys.com/speedtest/upload.php" lat="27.9709" lon="-82.4646" name="Tampa, FL" country="United States" cc="US" sponsor="Rapid Systems" id="1296" host="speedtestnet.rapidsys.com:8080" />
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
Sample outputs:
Not a fan of speedtest.net?
No worries. Try wget, lftp or specilized tool like iperf on a Linux to test the Internet or Intranet speed from the command line.
Concolusion
You learned how to install speedtest-cli command line interface for testing internet bandwidth using speedtest.net on a CentOS/RHEL/Fedora Linux. For more information see this page here.
🥺 Was this helpful? Please add a comment to show your appreciation or feedback.
As a big fan of speedtest-cli I’ve developed a fork (and a pull request) to store results into a CSV https://github.com/gonzalo/speedtest-cli
After this you can use this html to display a nice graphic report https://github.com/gonzalo/html-bandwidth-report
Link do not work!
Just adding a note on installation for SUSE* (OpenSUSE, SLES. SLED)…
Its (and dependencies are) in the SUSE repos, so its just:
sudo zypper in speedtest-cli
Done!
HI, I am the maintainer of speedtest-cli for Fedora/EPEL. You could have easily installed it trough yum/dnf.
yum install speedtest-cli
Hi,
Here is the updated instruction:
sudo yum install python
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli
./speedtest-cli
The file speedtest_cli.py has been deprecated in favor of speedtest.py
and is available for download at:
https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py