Test your internet speed through the command line

Photo by Anton Jansson on Unsplash

In this quick post, I will be sharing a simple trick to test your internet speed through the command line. I know you can test your internet speed through a web browser, but there might be a few reasons for which you would prefer the 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.

Whatever be the reason, testing your internet speed through the command line is much faster and easier. All you need to do is to install a package called speedtest-cli.

Installing speedtest-cli on Linux

On Ubuntu(or any other Debian based distro), run:

sudo apt install speedtest-cli

For other Linux distros, you must change the apt with the respective package managers:

  • dnf for Fedora
  • pacman for Arch
  • yum for CentOS
  • zypper for openSUSE

Installing speedtest-cli on Windows

Installing speedtest-cli on Windows is slightly more complicated. This is because first, you need to download and install Python. Then you need to ensure that both python and pip are added to the system PATH. But if you already have them installed, no worries! Just open the command prompt and run:

pip install speedtest-cli

Installing speedtest-cli on macOS

The simplest way to install speedtest-cli on a Mac is using Homebrew, the open-source package manager for Mac. Check out this 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.

Running speedtest-cli

Testing your internet speed using the command line is the same on all platforms. All you need to do is to type speedtest and hit the Enter key.

I hope you found this post helpful and, if you liked it, do consider sharing it with others.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Shounak Das

I am a passionate programmer and tech-geek. I love to code, and teach coding to beginners.