Screenshot of a Linux-based command line utility to test your internet speed.

Testing your internet speed from the command line on Windows, Linux, or Mac

Tobias Zimmergren
Tobias Zimmergren
💡TIP: Check out the guidance for building sustainable Azure workloads! 🌿

Table of Contents

I've recently come across the need to test the internet speed of devices without a Graphical User Interface (GUI) connected to the internet.

Devices include Raspberry Pi, virtual machines running Linux, cloud-based containers running Linux distros, and more.

Services like speedtest.net and fast.com are both very popular speed testing services, and you may recognize them by their UI:

Screenshot of a browser-based speedtest using the Speedtest.net service.
Screenshot of a browser-based speed test using Fast.com by Netflix.

When a UI is not available to us, running speed tests from the command line is another option that comes in handy. Let's explore a few options.

Speedtest using the Fast CLI (npm)

This solution works on any system where npm is available, including Windows, Mac, and Linux.

There's a GitHub project for the fast-cli, available as an npm package.

Install the package:

npm install --location=global fast-cli

Run the speed test:

fast -u

Note: I'm adding the -u flag to also measure the upload speed. By default, it measures download speed only.

Screenshot of running the Fast CLI from command line.

Speedtest using the speed-test CLI (npm)

This solution works on any system where npm is available, including Windows, Mac, and Linux.

Install via npm:

npm install --location=global speed-test

Run the speed test:

speed-test
Screenshot of the speed-test CLI performing an internet speed test from the local device.

Speedtest using the speedtest-cli (Linux only)

On any of my Raspberry Pi and other IoT-enabled devices where I have a Linux-based OS, or my cloud-based VMs and containers running Linux, the speed test can be done by installing the official speedtest-cli.

Install with apt install:

sudo apt install speedtest-cli

Run the speed test:

speedtest
Screenshot of the official speedtest cli running on a Linux device.

It became clear to me that my Raspberry Pi (from the screenshot above), is a slightly older model where it only supports 100 Mbit ethernet. Newer models have Gigabit capabilities.

That's it. Enjoy testing your speeds!

Tools

Tobias Zimmergren Twitter

Hi, I'm Tobias! 👋 I write about Microsoft Azure, security, cybersecurity, compliance, cloud architecture, Microsoft 365, and general tech!

Reactions and mentions


Hi, I'm Tobias 👋

Tobias Zimmergren profile picture

Find out more about me.

Recent comments

Mastodon