Consistently measuring internet speed on a Linux host confirms whether a connection is healthy, validates what an ISP promised, and exposes bottlenecks before interactive traffic starts stuttering. Command-line testing also makes it easy to measure from remote servers reached only over SSH, which helps separate local Wi‑Fi problems from upstream congestion.

Most speed tests select a nearby measurement endpoint, record round-trip latency, and then transfer data in both directions to estimate throughput. The speedtest-cli utility provides terminal access to the Speedtest.net infrastructure and reports ping in milliseconds plus download and upload speeds in megabits per second.

Reported numbers vary with Wi‑Fi signal quality, VPN tunnels, background transfers, and the chosen test server, so single runs are rarely representative. Each test can briefly saturate the link and consume significant bandwidth, which matters on metered connections or shared production links. More reliable comparisons come from repeating tests over time and pinning runs to a specific server ID.

Steps to test internet speed with speedtest-cli in Linux:

  1. Open a terminal on the Linux system where the connection should be measured.
    $ whoami
    user

    Any user account with outbound internet access can run speedtest-cli.

  2. Confirm basic reachability to a public IP address.
    $ ping -c 4 203.0.113.50
    PING 203.0.113.50 (203.0.113.50) 56(84) bytes of data.
    64 bytes from 203.0.113.50: icmp_seq=1 ttl=128 time=4.90 ms
    64 bytes from 203.0.113.50: icmp_seq=2 ttl=128 time=5.62 ms
    64 bytes from 203.0.113.50: icmp_seq=3 ttl=128 time=6.20 ms
    64 bytes from 203.0.113.50: icmp_seq=4 ttl=128 time=5.43 ms
    
    --- 203.0.113.50 ping statistics ---
    4 packets transmitted, 4 received, 0% packet loss, time 3013ms
    rtt min/avg/max/mdev = 4.904/5.536/6.196/0.462 ms

    Packet loss or very high latency indicates a connectivity problem that will skew speed test results, but some networks block ICMP so ping can fail even when web traffic still works.

  3. Run a quick test using speedtest-cli to display latency, download, and upload speeds.
    $ speedtest-cli --simple
    Ping: 5.317 ms
    Download: 94.06 Mbit/s
    Upload: 96.15 Mbit/s

    Add --bytes to display MByte/s instead of Mbit/s.

  4. Run the test with full output if more detail about the chosen server and transfer phases is needed.
    $ speedtest-cli
    Retrieving speedtest.net configuration...
    Testing from Example ISP (203.0.113.10)...
    Retrieving speedtest.net server list...
    Selecting best server based on ping...
    Hosted by Example ISP (Example City) [22.26 km]: 6.169 ms
    Testing download speed................................................................................
    Download: 93.12 Mbit/s
    Testing upload speed......................................................................................................
    Upload: 75.44 Mbit/s

    Full output shows the selected server and the progress of each test phase, and --secure forces HTTPS if required by the network.

  5. Generate JSON-formatted results to feed into monitoring tools or custom scripts.
    $ speedtest-cli --json
    {"download": 93286454.72241284, "upload": 95720755.15862213, "ping": 6.535, "server": {"url": "http://downloads.example.net:8080/speedtest/upload.php", "lat": "37.0000", "lon": "-122.0000", "name": "Example City", "country": "US", "cc": "US", "sponsor": "Example ISP", "id": "12108", "host": "downloads.example.net:8080", "d": 22.26029308446163, "latency": 6.535}, "timestamp": "2026-01-10T21:59:03.379206Z", "bytes_sent": 120184832, "bytes_received": 117084152, "share": null, "client": {"ip": "203.0.113.10", "lat": "37.0050", "lon": "-122.0050", "isp": "Example ISP", "isprating": "3.7", "rating": "0", "ispdlavg": "0", "ispulavg": "0", "loggedin": "0", "country": "US"}}

    JSON download and upload values are in bits per second, so dividing by 1000000 converts them to Mbit/s.

  6. List available test servers to target a specific location, such as the provider edge or a remote data center.
    $ speedtest-cli --list | head -n 8
    Retrieving speedtest.net configuration...
    12108) Example ISP (Example City, US) [22.26 km]
    70826) ExampleNet (Example City, US) [22.32 km]
    49683) Example Edge (Example City, US) [22.53 km]
    19403) Example Broadband (Example City, US) [23.00 km]
    63813) Example Transit (Example City, US) [23.00 km]
    62527) Example Fiber (Example City, US) [23.00 km]
    67602) Example Metro (Example City, US) [23.00 km]

    Choosing a distant server includes long-haul latency and can understate local access-link performance.

  7. Run a test against a chosen server by passing its numeric ID to the speedtest-cli command.
    $ speedtest-cli --server 12108 --simple
    Ping: 6.309 ms
    Download: 93.12 Mbit/s
    Upload: 12.87 Mbit/s

    Using the same server ID across multiple runs makes historical comparisons more reliable.

  8. Repeat the test at different times of day to capture peak and off-peak behaviour.

    Running tests during busy evening hours and quiet early-morning periods highlights congestion patterns.

  9. Save one or more test runs to a log file so the results can be revisited or shared with support.
    $ speedtest-cli --simple | tee -a speedtest.log
    Ping: 4.595 ms
    Download: 94.27 Mbit/s
    Upload: 96.07 Mbit/s

    Inspecting accumulated speedtest.log entries later confirms trends and provides evidence when opening a ticket with a provider.