How to Test Your Internet Speed from the Command Line

Want to quickly check the speed of your current Internet connection? With speedtest-cli you can run a test in the command prompt, on any operating system.

We’ve shown you how to test your internet connection speed using a web browser, but there are a few reasons you might want a command line tool instead. Maybe you’re remotely connected to a server via ssh, and want to test speeds on that machine. Maybe you’re already used to using commands to troubleshoot your network, and want to add a speedtest to your toolkit. Or maybe you just think the command line is cool. No judgement.

Whatever your reason, running a speedtest is as simple as typing speedtest and hitting enter once you have speedtest-cli installed. Here’s how to install it on all three major operating systems.

Installing speedtest-cli On Ubuntu (and Other Linux Distros)

Installing speedtest-cli on Ubuntu (and other Debian-based distros) couldn’t be easier. Just run one command:

sudo apt install speedtest-cli

The command might differ somewhat on other Linux distributions, so check your distro’s package manager and look for a package named speedtest-cli.

Installing speedtest-cli on macOS Using Homebrew

The simplest way to install speedtest-cli on a Mac is using Homebrew, the open source package manager for Mac. Check out our guide to installing Homebrew if you don’t have it set up (if you use the command line a lot, you should absolutely install Homebrew).

Once Homebrew is set up, you can install speedtest-cli with a simple command:

brew install speedtest_cli

Note the underscore in the package name: for some reason the name is different in Homebrew than the Linux package manager.

Installing speedtest-cli On Windows

This is slightly more complicated, but totally doable. First you’ll have to to install Python on Windows, which basically means downloading the correct installer and ensuring that python and pip are both added to your system PATH.

Once you’re done with that, installing speedtest-cli is a matter of running one command:

pip install speedtest-cli

You can now use speedtest-cli on Windows. Note that you could use pip to install speedtest-cli on Linux and macOS systems, but it’s simpler to use the system-wide package manager for consistency’s sake.

Justin Pot is a staff writer for How-To Geek, and a technology enthusiast who lives in Hillsboro, Oregon. Follow him on Twitter and Facebook, if you want. You don't have to.