How to Test Internet Speed from the Command Line on Linux

It’s dead easy to test your internet connection speed on a modern computer: just open a web browser, head to the speedtest.net website, and bam: away you go.

But there are other ways to test your network data speed on Linux, including using the command line.

Perhaps you want to check your network speeds match up with the ones you pay your ISP for, or see if a connection issue bugging you is real or imagined. Whichever; being able to run an internet speed test from the command line will come in handy.

In this tutorial I show you how to run a network speed test right from the Terminal using an app available in the repositories of most major Linux distributions. It’s not the the only tool for the job (and some argue not the best, either) but is one that’s a breeze to use.

Using ‘speedtest-cli’ on Linux

Now, to set your expectations, I will mention that running an internet speed test from the command line isn’t quite as exciting as other methods. You don’t get to see speedometers ticking vicariously, or colorful bar charts undulating before your eyes.

But you do get what you need: data, and fast.

We’ll use a Python tool called speedtest-cli to test internet speeds on Linux. This uses the speedtest.net website I mentioned at the start of this post. Using it you can test your internet upload and downloads speeds, and measure your ping.

I will add that some websites/servers/ISPs are savvy to traffic from this site, so take the results with a small thimble of NaCl.

First things first: install the speedtest-cli tool on your Linux system. The exact way to do this will vary based on your OS but the package is in the repos of every major Linux distro meaning you can run sudo apt install speedtest-cli (or your distro’s equivalent) to get it.

Once installed:

1) Open a new Terminal window (on most Linux distributions you can do this quickly by pressing the ctrl + t keys)

2) In the Terminal’s window, type the following command:

speedtest-cli --simple

3) Press the Enter key on your keyboard to run the command.

The app takes 30 seconds or so to properly measure your upload and download speeds so do be patient. Once it’s ready you’ll see a concise report:

a screenshot of the speedtest-cli tool running on Ubuntu
speedtest-cli: simple and to the point

If you want to see more information about your network during and after the test (such as IP address, test location, etc) you can run speedtest-cli without the --simple flag. This delivers a more verbose output, like so:

I’ve masked my IP here but you’ll see yours

And to see the full range of options available with the tool —there are lots— run the speedtest-cli -h command to crib the man page.

Conclusion

So that’s it; you now know how to run a network speed test on any Linux distro from whatever terminal emulator or CLI environment is provided

How do you prefer to do network speed tests? Does being able to do it from the command line instead of a dedicated network test website appeal? Share your thoughts on this tutorial down in the comments section!