How To Run SpeedTest From The Linux Terminal
Speedtest.net is a handy tool for Linux server admins and enthusiasts as it helps them quickly test ping, bandwidth, and other network information from the comfort of a website. Still, for as good as the Speedtest.net website is, it’s not very useful if you’re trying to test the internet connection of a remote server and don’t have access to a web browser.
Introducing Speedtest-cli: it’s a command-line utility that lets you run Speedtest from the Linux terminal. It does everything that the Speedtest website does but with Linux command arguments. To install this software, you’ll need the latest version of the Python programming language.
Install Speedtest-cli
Speedtest-Cli is installable via many different Linux distribution’s software sources. It is also available via the source code or the Python Package tool.
Ubuntu
sudo apt install speedtest-cli
Debian
sudo apt-get install speedtest-cli
Arch Linux
Arch users looking to install Speedtest-cli will need to first enable the “Community” software repository in /etc/pacman.conf. To activate, launch a terminal and open pacman.conf with Nano.
sudo nano /etc/pacman.conf
Scroll down and find “Community.” Remove all instances of # from in front of “Community,” and the lines underneath it as well. After removing the # symbols, press Ctrl + O to save the edits, and exit Nano with Ctrl + X.
Re-sync your Pacman to enable the Community repo.
sudo pacman -Syy
With the Community rep now up and running on your Arch Linux PC, install the speedtest-cli utility.
sudo pacman -S speedtest-cli
Fedora
sudo dnf install speedtest-cli -y
OpenSUSE
sudo zypper install speedtest-cli
Generic Linuxes Via Python PIP
If you can’t get the Speedtest-cli utility, you’ll be able to get it going with Python and PIP. To start the installation, open up a terminal window and ensure you have the latest version of both Python and Pip. When you’ve determined you have the newest version of Python and Pip working on your Linux PC, install Speedtest-cli with the following command.
Note: do not try to use sudo during the installation, as it will mess up your Python development environment.
pip install speedtest-cli
Generic Linuxes via building from source
Going the Python Pip route on generic Linux distributions is usually the easiest way to get it going if your Linux distribution doesn’t care the software. However, if PIP doesn’t work, there’s another solution: building from source.
Before installing Speedtest-cli via the Github source code, install the Python programming language, as well as the Git tool. Then, use the git clone command to grab the code.
git clone https://github.com/sivel/speedtest-cli.git
Move your terminal into the speedtest-cli code folder and update the contents’ permissions.
sudo chmod +x *
Run the installation tool to get Speedtest-cli working on your Linux PC.
python setup.py install
Use Speedtest-Cli
To run a basic internet speed test with the Speedtest-cli tool, launch a terminal, and run speedtest-cli in it. What follows is a basic test of your ping, upload, and download speed. The results of your internet test will show up in text form when the process is complete.
speedtest-cli
If you’re new to using the terminal and wish internet test results were easier to read, add the simple modifier to speedtest-cli commands.
speedtest-cli --simple
Download-only Test
Want to figure out your download speed but don’t feel like running a full internet speed test? Try running the speedtest-cli command with the no-upload modifier.
speedtest-cli --no-upload
Combine no-upload with the simple modifier for an easy to read experience.
speedtest-cli --no-upload --simple
Upload-only Test
Running speedtest-cli with the no-download command will allow the user to do an “upload only” test.
speedtest-cli --no-download
For best results, run with the simple modifier.
speedtest-cli --no-download --simple
View Graphical Results
When you run an internet speed test on Speedtest.net, you have the option of viewing your network results in a PNG image. If you want a picture result of speed tests you run with speedtest-cli in the terminal, add the share modifier.
speedtest-cli --share --simple
Speedtest With Bytes
Each internet test you run with the speedtest-cli command is measured in bits. It’s the universal standard for measuring speed on the internet. If this doesn’t sit right with you, consider using the bytes modifier in your tests.
speedtest-cli --bytes
Export SpeedTest To CSV
Do you run speed tests a lot? Want to keep track of your data? Consider running the speedtest-cli command with the csv modifier. Using this feature prints out test results in the “csv” text format which is easily pasteable in spreadsheet programs like Microsoft Excel or Libre Office Calc.
speedtest-cli --csv
Other Speedtest-cli Features
In this tutorial, we go over many different useful features that you can use with speedtest-cli. Though, there are many other useful features that we haven’t covered.
To access the other Speedtest command-line features, run the following command in a terminal window.
speedtest-cli --help
Alternatively, save the help page to a text file with:
speedtest-cli --help >> ~/Documents/speedtest-cli-commands.txt