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 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 that your network speeds match up to what you pay your ISP for, or see if a connection issue currently bugging you is real or imagined. Whichever; being able to run an internet speed test from the command line is handy, and easy to do.

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 might argue not the best) but is one that’s simple to use.

Using ‘speedtest-cli’ on Linux

Now, to set your expectations, I must mention that running an internet speed test from the command line isn’t as exciting as other methods. You won’t get to see a flashy speedometer ticking vicariously, nor colorful bar charts undulating wave-like before your eyes.

But you get what you need: data — and fast.

I use a Python tool called speedtest-cli to test internet speeds on Linux. This uses the website mentioned at the start of this post. Using this you can test your internet upload and downloads speeds, and measure 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 + alt + t keys)

2) In the terminal window, type this command:

speedtest-cli --simple

3) Press the Enter key on your keyboard

The app will take 30 seconds or so to measure your upload and download speeds so be patient. Once complete you get to see a concise report that looks like this:

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 more verbose output, like so:

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

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.


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!