Ubuntu / Linux news and application reviews.

If you want to test the Internet speed on a server or you simply want to avoid the speedtest.net Flash interface, you can use speedtest-cli, a command line tool for testing Internet bandwidth.

speedtest-cli tests your Internet speed using the popular speedtest.net website and it supports listing servers sorted by distance, testing against a specific server, you can use it with a Speedtest Mini server and it can even generate and provide a URL to the speedtest.net share results image.

speedtest-cli ubuntu


Install speedtest-cli


speedtest-cli can be installed using Python Pip. To install Pip in Ubuntu, use the following command:
sudo apt-get install python-pip

Then, install speedtest-cli:
sudo pip install speedtest-cli

Later on, when you want to upgrade speedtest-cli, use the following command:
sudo pip install speedtest-cli --upgrade

For other ways of installing speedtest-cli, see its GitHub page.


How to use speedtest-cli


To test your Internet connection speed from the command line using the best server based on ping, all you have to do is run the following command:
speedtest-cli

"speedtest" also works for the command instead of "speedtest-cli" (if you've installed the tool using Python Pip). So below I'll use the shorter command, "speedtest".

To test the Internet speed and get a share results image URL (here's an example), use:
speedtest --share

For advanced usage, like displaying the speedtest.net servers, test against a given server and so on, run:
speedtest -h

Here are all the available arguments:
usage: speedtest [-h] [--share] [--simple] [--list]
                     [--server SERVER] [--mini MINI] [--source SOURCE]
                     [--version]
Command line interface for testing internet bandwidth using
speedtest.net.
-----------------------------------------------------------------------
https://github.com/sivel/speedtest-cli

optional arguments:
  -h, --help       show this help message and exit
  --share          Generate and provide a URL to the speedtest.net
                   share results image
  --simple         Suppress verbose output, only show basic
                   information
  --list           Display a list of speedtest.net servers sorted by
                   distance
  --server SERVER  Specify a server ID to test against
  --mini MINI      URL of the Speedtest Mini server
  --source SOURCE  Source IP address to bind to
  --version        Show the version number and exit