DEV Community

Cover image for Test your Internet Speed through the Command Line
Shounak Das
Shounak Das

Posted on • Updated on

Test your Internet Speed through the Command Line

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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.
Thanks for reading.🙏

Top comments (0)