How to Test Internet Download and Upload Speeds in Ubuntu Terminal

When configuring a headless home server, troubleshooting patchy Wi-Fi bandwidth on a laptop, or verifying that your broadband provider is delivering advertised gigabit speeds, opening a graphical browser window is not always convenient or possible. In Ubuntu Linux, testing network throughput directly from the command line provides rapid, lightweight, and scriptable performance metrics. Using dedicated terminal speedtest utilities, you can measure ping latency, jitter, download throughput, and upload bandwidth in seconds.

Why Terminal Speed Tests are Superior on Linux

Running network speed benchmarks in the command line offers distinct technical advantages over web-based browser testers:

  • Zero Browser Overhead: Eliminates JavaScript engine rendering delays, heavy animated gauges, and third-party advertising banners that can artificially throttle performance on budget machines.
  • Server & Remote Friendly: Functions seamlessly over remote SSH connections on headless Ubuntu servers without requiring desktop environments.
  • Automated Scripting: Easily outputs diagnostic metrics into JSON or CSV formats, allowing you to log internet performance to automated cron monitoring jobs.

Method 1: Installing the Lightweight Python speedtest-cli

For quick ad-hoc testing available directly through Ubuntu’s default software repositories:

  1. Press Ctrl + Alt + T on your keyboard to open the terminal.
  2. Install the package via APT:
    sudo apt update && sudo apt install speedtest-cli
  3. Run a simple test by executing:
    speedtest-cli
  4. The utility automatically selects the closest testing server, measures latency, streams download speed, tests upload throughput, and returns clean results.
  5. To generate a shareable PNG results card, append the share flag: speedtest-cli --share.

Method 2: Installing the Official Ookla Speedtest CLI (Recommended for Gigabit)

For high-accuracy multi-gigabit connections, the official native C++ Ookla binary provides superior multi-threaded throughput:

  1. Add the official Ookla repository script:
    curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
  2. Install the official speedtest client:
    sudo apt install speedtest
  3. Execute the benchmark:
    speedtest
  4. Type YES to accept the initial Ookla licence terms.
  5. The tool streams live progress bars displaying latency jitter, download bandwidth, and upload bandwidth with high precision.

Outputting Benchmark Results as JSON or CSV

If you want to pipe connection statistics into monitoring dashboards or backup logs:

  1. To export results as clean JSON:
    speedtest -f json
  2. To export results as comma-separated values:
    speedtest -f csv

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.