Speedtest is the most widely used internet speed test tool. In graphic mode, it’s very simple to use. But Speedtest in the terminal? Yes, this is also possible: Linux has unlimited possibilities.
What is speedtest-cli?
The application is written in Python and measures the speed of the internet connection in bidirectional way, using the speedtest.net infrastructure. Speedtest-cli lists servers according to physical distance, allows testing according to the desired server, and gives you the opportunity to show others what speed you have.
How to install speedtest-cli
Most of the times we have found ourselves in the situation where we need to check the internet speed of a Linux server. Now, using the commands below, we have the possibility to do it. In order to run the speedtest in the terminal we need to install the speedtest-cli application:
1. After accessing the server we want to test, download the speedtest-cli application in the /home/%username% folder or anywhere else you want to: wget -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest cli.py or curl -o speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
2. Define the downloaded file as executable by using the command below, regardless of the command you used before:
chmod + x speedtest-cli
3. Then use the speedtest-cli command
Please use the speedtest-cli -h command for more details about the application. Be careful! Do not use the presented application in production situations (eg latent reporting).
Speedtest-cli in Arch Linux
The fantastic Arch Linux! Speedtest-cli is located in AUR and can be installed via Octopi or using one of the AUR assistants:
pacaur -S speedtest-cli
or
yaourt speedtest-cli
Speedtest-cli in Ubuntu
First, the python-pip package must be installed, and then install the speedtest-cli:
sudo apt-get install python-pip
sudo pip install speedtest-cli
Updating the speedtest-cli in Ubuntu:
sudo pip install speedtest-cli --upgrade
Internet speed testing with speedtest-cli
To test the download and upload speed with the nearest server, write the speedtest-cli command without any argument:
speedtest-cli
For Ubuntu:
speedtest_cli.py
To display speed in bytes instead of bits:
speedtest-cli --bytes
To get the classic speedtest image that we can show to others:
speedtest-cli --share
Additional information (ping, download, upload):
speedtest-cli --simple
Listing all speedtest.net servers and switching them to a text file:
speedtest-cli --list > servers.txt
To see the list of servers in the servers.txt file (placed in ascending order according to the physical distance to them) we will use a less pager:
less servers.txt
To test Internet speed with any server from the list of servers:
speedtest-cli --server server_number
To check the speedtest-net version:
$ speedtest-cli –version
0.3.4
$
Using pip install –user speedtest-cli gives you a version that is probably newer than the one available in the repositories of your distribution.
For help with speedtest-cli:
speedtest-cli --help
Conclusions
Speedtest in Terminal is a third-party application more useful to the system administrators, but it can also be used with confidence by regular users who want to find out faster if their network works (without opening the browser and surfing to speedtest.net).