Easy way to Test Internet Speed on Linux Terminal

|
Last Updated:
|
|

In this tutorial, we will show you an easy way to test Internet speed on Linux terminal. More often than not you might want to know or confirm the capacity at which your ISP network can transmit data here in referred to Internet speed or bandwidth. In most cases, folks uses browser-based tools to test their Internet speed. However, there are command line-centric ninjas that want to use Linux terminal or command line to test their Internet speed. This guide is for them, -:).

Test Internet Speed on Linux Terminal

One of the most popular sites that appears at the top of the Google search results for the keyword “speed test” is https://www.speedtest.net by Speedtest by Ookla.

Easy way to Test Internet Speed on Linux Terminal

When you hit the Go button, the site will calculate your download and upload speed.

Well, Speedtest by Ookla also provides a speedtest-cli tool that you can install on Linux systems to enable you perform Internet speed test on Linux terminal.

As much as there could other command line based tools that you can use to test your ISP Internet speed test on a Linux command line, this guide will only focus on speedtest cli tool by Ookla.

Install Speedtest CLI Tool

Install Speedtest CLI Tool on Ubuntu/Debian

Note that default Ubuntu repositories by default ships with another speedtest-cli tool which is available on the default Ubuntu universe repositories;

apt info speedtest-cli

This tool has since become increasingly inaccurate with high-speed connections.

Thus, you need to install speedtest utility by Ookla.

As a result, you need to install Ookla repositories;

apt install wget curl gnupg2 apt-transport-https
wget -qO- https://packagecloud.io/ookla/speedtest-cli/gpgkey | \
gpg --dearmor -o /etc/apt/trusted.gpg.d/ookla.gpg
echo -e \
"deb https://packagecloud.io/ookla/speedtest-cli/ubuntu/ $(lsb_release -sc) main 
deb-src https://packagecloud.io/ookla/speedtest-cli/ubuntu/ $(lsb_release -sc) main" \
> /etc/apt/sources.list.d/ookla.list
apt update

Install Ookla speedtest CLI tool on Ubuntu/Debian

apt install speedtest

Install Speedtest CLI Tool on CentOS/Oracle/Fedora Linux

Similarly, CentOS/Fedora/Oracle Linux ships with speedtest-cli too which has since become in-accurate with high-speed connections.

To install Speedtest by Ookla on CentOS/Oracle/Fedora Linux;

Install Epel repository;

yum install epel-release

echo -e \
"[ookla_speedtest-cli]
name=ookla_speedtest-cli
baseurl=https://packagecloud.io/ookla/speedtest-cli/el/`rpm -E %{rhel}`/x86_64
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/ookla/speedtest-cli/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300" > /etc/yum.repos.d/ookla_speedtest-cli.repo
yum install speedtest

Test Internet Speed on Linux Terminal

How can you use speedtest command line tool to test Internet connection speed?

speedtest --help

Speedtest by Ookla is the official command line client for testing the speed and performance of your internet connection.

Version: speedtest 1.2.0.84

Usage: speedtest []
  -h, --help                        Print usage information
  -V, --version                     Print version number
  -L, --servers                     List nearest servers
  -s, --server-id=#                 Specify a server from the server list using its id
  -I, --interface=ARG               Attempt to bind to the specified interface when connecting to servers
  -i, --ip=ARG                      Attempt to bind to the specified IP address when connecting to servers
  -o, --host=ARG                    Specify a server, from the server list, using its host's fully qualified domain name
  -p, --progress=yes|no             Enable or disable progress bar (Note: only available for 'human-readable'
                                    or 'json' and defaults to yes when interactive)
  -P, --precision=#                 Number of decimals to use (0-8, default=2)
  -f, --format=ARG                  Output format (see below for valid formats)
      --progress-update-interval=#  Progress update interval (100-1000 milliseconds)
  -u, --unit[=ARG]                  Output unit for displaying speeds (Note: this is only applicable
                                    for ‘human-readable’ output format and the default unit is Mbps)
  -a                                Shortcut for [-u auto-decimal-bits]
  -A                                Shortcut for [-u auto-decimal-bytes]
  -b                                Shortcut for [-u auto-binary-bits]
  -B                                Shortcut for [-u auto-binary-bytes]
      --selection-details           Show server selection details
      --ca-certificate=ARG          CA Certificate bundle path
  -v                                Logging verbosity. Specify multiple times for higher verbosity
      --output-header               Show output header for CSV and TSV formats

 Valid output formats: human-readable (default), csv, tsv, json, jsonl, json-pretty

 Machine readable formats (csv, tsv, json, jsonl, json-pretty) use bytes as the unit of measure with max precision

 Valid units for [-u] flag: 
   Decimal prefix, bits per second:  bps, kbps, Mbps, Gbps
   Decimal prefix, bytes per second: B/s, kB/s, MB/s, GB/s
   Binary prefix, bits per second:   kibps, Mibps, Gibps
   Binary prefix, bytes per second:  kiB/s, MiB/s, GiB/s
   Auto-scaled prefix: auto-binary-bits, auto-binary-bytes, auto-decimal-bits, auto-decimal-bytes

You can simply execute it without no options to test Internet speed on Linux terminal.

speedtest

Accept the end user license agreement and proceed to test Internet connection speed.


==============================================================================

You may only use this Speedtest software and information generated
from it for personal, non-commercial use, through a command line
interface on a personal computer. Your use of this software is subject
to the End User License Agreement, Terms of Use and Privacy Policy at
these URLs:

	https://www.speedtest.net/about/eula
	https://www.speedtest.net/about/terms
	https://www.speedtest.net/about/privacy

==============================================================================

Do you accept the license? [type YES to accept]: YES
License acceptance recorded. Continuing.


   Speedtest by Ookla

[error] Error: [0] Cannot open socket
[error] Error: [0] Cannot open socket
      Server: Vijiji Connect Limited - Nairobi (id: 38303)
         ISP: Safaricom
Idle Latency:    16.89 ms   (jitter: 0.37ms, low: 16.29ms, high: 17.29ms)
    Download:    21.16 Mbps (data used: 28.5 MB)                                                   
                 27.12 ms   (jitter: 17.47ms, low: 16.60ms, high: 907.09ms)
      Upload:    19.43 Mbps (data used: 32.9 MB)                                                   
                 22.03 ms   (jitter: 12.49ms, low: 17.13ms, high: 380.48ms)
 Packet Loss:     0.0%
  Result URL: https://www.speedtest.net/result/c/caf9b6f8-d4bb-4c09-b665-ed821c38659d

You can print the output in different formats;

speedtest -f json-pretty

{
    "type": "result",
    "timestamp": "2022-11-14T21:09:01Z",
    "ping": {
        "jitter": 0.993,
        "latency": 16.579,
        "low": 16.002,
        "high": 18.150
    },
    "download": {
        "bandwidth": 2731345,
        "bytes": 27656856,
        "elapsed": 10008
    },
    "upload": {
        "bandwidth": 2451465,
        "bytes": 27651819,
        "elapsed": 10603,
        "latency": {
            "iqm": 21.777,
            "low": 15.447,
            "high": 363.695,
            "jitter": 14.991
        }
    },
    "packetLoss": 0,
    "isp": "Safaricom",
    "interface": {
        "internalIp": "10.0.2.15",
        "name": "enp0s3",
        "macAddr": "08:00:27:70:3D:6C",
        "isVpn": false,
        "externalIp": "41.xx.65.2x9"
    },
    "server": {
        "id": 21848,
        "host": "speedtest-thk.safaricom.com",
        "port": 8080,
        "name": "Safaricom",
        "location": "Nairobi",
        "country": "Kenya",
        "ip": "197.248.2xx.102"
    },
    "result": {
        "id": "14aa97ac-b2cc-4ca9-ac8b-5e32f445486c",
        "url": "https://www.speedtest.net/result/c/14aa97ac-b2cc-4ca9-ac8b-5e32f445486c",
        "persisted": true
    }
}

You can as well follow the given url to view the results.

Easy way to Test Internet Speed on Linux Terminal

And that is it on how you can test Internet Speed on Linux Terminal.

Installing Perf Performance Analysis Tool on CentOS 8

Set Static Routes via an Interface/IP on CentOS/Ubuntu

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
gen_too
Co-founder of Kifarunix.com, Linux Tips and Tutorials. Linux/Unix admin and author at Kifarunix.com.

Leave a Comment