Test Internet Speed from Command Line on Windows, Mac and Linux

In order to test our broadband speed, we generally visit online speed testing sites like Speedtest.net or Fast.com, however there are many a times we may want to test the speed of the internet from the command line (terminal).

Whether you are a power user who normally uses command line over the GUI, or simply want to monitor your website speed without visiting an online site filled with ads, then there are couple of ways you can check your internet speed from the terminal on your OS. These commands will work on all operating systems including Windows, Mac and Linux.

speed test from command line
Speed test from command line

Install Pre-requisites

In order to test the net speed from command line, we will have to install a few programs. These programs require NodeJS which is available for all operating systems.

Head over to the NodeJS downloads page and grab the latest version suitable for your Operating System. You may already have NodeJS installed on your system. To check whether NodeJS is installed or not, run the command ‘node -v’ in terminal (or cmd).

$ node -v

Once you have NodeJS installed, you will be able to install publicly available npm modules. These modules are generally open source programs or libraries which serve different purposes. For example, we will make use of two node modules speed-test and fast-cli below to check internet speed. Both the programs are free, open source and developed by Sindre Sorhus.

Internet speed via speed-test CLI

Using the terminal, install speed-test module with the following command:

$ npm install --global speed-test

It will take a while for the module to get installed. Once it finishes installing, you will be able to run the command ‘speed-test’ from the command line. Running the command ‘speed-test’ will perform a speed test via your terminal and present a textual result as shown below:

$ speed-test

Ping     34 ms
Download 11.9 Mbps
Upload   12 Mbps

The program tests your internet connection speed and ping using speedtest.net and displays the result in the terminal itself.

If you want a more detailed result, you can run the command ‘speed-test -v’ and it will give a verbose output which includes the server location and distance. You can refer to the documentation of this open source program on GitHub.

Internet speed via fast-cli

Alternatively, you can install and use fast-cli if you want to test your internet speed using fast.com.

Using the terminal, install fast-cli module with the following command:

$ npm install --global fast-cli

Once it finishes installing, you will be able to run the command ‘fast-cli’ from you terminal and will get internet speed result as show below:

$ fast

  / 12 Mbps

You can refer to the documentation of this open source program on GitHub.

Internet speed Comparison and Fixing Slow Internet

Command line utilities shown above are helpful in performing internet speed checks and for doing comparison of internet speed. If you are facing slow internet speed then you can use these command line tools to check your internet speed without the need of opening a browser and visiting any site.

Don’t forget to see our guide on how to use Google DNS to boost your internet browsing experience.

Kanishk Kunal

Kanishk is a Software Engineer turned Online Entrepreneur who has created many successful apps and websites. He devotes most of his time punching his keyboard and swiping his smartphone. Follow him on Twitter @kanishkkunal

This Post Has One Comment

  1. Avatar
    Arshdeep Singh

    This was helpful. Thank you.

Leave a Reply