How to test your internet speed from the Linux command line

Sometimes when you try to update your system or install new software, you may find that it takes a long time. In such cases, an internet speed test can help determine if the problem is on your end or if it is a server-side problem.

Let’s learn how you can easily test your internet from a Linux terminal.

What is a speed test and why is it important?

A speed test, as the name hints, is the process of testing the speed of your internet connection. Your computer sends a few packets to a remote server. The number of packets sent per second, and then the latency of each transmission is measured.

Internet Speed ​​Test tells you if your Internet Service Provider is delivering the promised Internet speed in your subscription. It can be useful at times Network troubleshooting In Apps, Speed ​​Test tells you if a particular app is having connectivity issues or your internet connection is running slow.

Test your internet speed from the Linux Terminal with the Speedtest CLI

Run speedtest-cli sample By Ookla is a popular internet speed test website. You’ve probably used it every time you needed to test your internet.

Did you know it has an official CLI that does everything a website can do but from the comfort of your own Linux terminal? Well now you do. Testing internet speed from a Linux terminal is a quick and easy process that can be done with a few simple commands.

As an initial step, update your system using your distro’s package manager.

On Ubuntu/Debian derivatives, run:

 sudo apt update && sudo apt upgrade 

On Arch based systems, run:

 sudo pacman -Syu 

On Fedora, CentOS, and RHEL, issue the following command:

 sudo dnf update 

Now that your system is updated, proceed to install the speedtest-cli package using your distribution’s package manager.

In Ubuntu/Debian derivatives, type:

 sudo apt install speedtest-cli 

On Arch based systems, run:

 sudo pacman -S speedtest-cli 

To install the Speedtest CLI on Fedora, CentOS, and RHEL, issue the following command:

 sudo dnf install speedtest-cli 

Speedtest CLI is now installed on your system. To test your internet speed, you just need to type speedtest-cli and hit Enters.

The tool should automatically find the optimal server for speed testing and return the desired results, including your internet speed in Mbps (megabits per second). Besides basic internet speed tracking, Speedtest CLI offers a few additional options worth checking out.

If you want to test your internet speed with a specific server, you can use –server tag followed by the server ID. This is an example:


You can specify the number of bytes to transfer during a speed test with a file – Byte science. for example:


To save your speed test results to a file, you can use the –Produce flag followed by the file name. Here’s how it should look:

 speedtest-cli --output results.txt 

For a comprehensive guide to all features of the speedtest-cli tool, use Speed ​​man Command to read its man page. Or check out the file Web based alternative to man command.

You now know how to test your internet on Linux

An online speed test helps diagnose network problems and keep track of overall network performance. With the Speedtest CLI, you can easily test your internet directly from the device without opening a browser. This can be very useful when working with headless servers or command line based systems, which in most cases are servers.

If you need to install a GUI on your server, you can do that as well.

Leave a Comment