Since 2016 · 50,000+ customers · ★ 5.0 on Google Live chatWhatsAppTelegramOpen a ticket
Get started
Linux

How to Run an Internet Speed Test on Ubuntu (Command Line)

How to run a speed test on Ubuntu guide by 99RDP

On a server there's no browser to open speedtest.net, but you can run the same test from the terminal in under a minute. This is useful to check a new VPS's bandwidth, troubleshoot a slow website or download, or compare locations. This guide covers Ookla's official Speedtest CLI, the older Python speedtest-cli, picking a specific test server, reading the results correctly, and using iperf3 for server-to-server tests. It works on Ubuntu 20.04, 22.04, 24.04 and 26.04, and on Debian.

Quick answerThe quickest option is the packaged Python client:

sudo apt install speedtest-cli
speedtest-cli --simple

For the most accurate results, use Ookla's official speedtest CLI (below).

The official client is made by the company behind speedtest.net. It's multi-threaded, measures latency and jitter, and handles high-speed (1 Gbps and above) connections far better than the Python version.

  1. Remove the Python client first if it's installed, because both use the speedtest name:
    sudo apt remove speedtest-cli
  2. Add Ookla's repository and install:
    sudo apt install curl
    curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
    sudo apt install speedtest
  3. Run the test (accept the licence on first run):
    speedtest

If Ookla's repository doesn't support your Ubuntu release yet, download the Linux binary (.tgz for x86_64 or ARM) from speedtest.net/apps/cli, extract it and run ./speedtest directly.

Useful options

speedtest -L                 # list nearby servers with their IDs
speedtest -s 12345           # test against a specific server ID
speedtest -f json            # machine-readable output for scripts
speedtest --accept-license --accept-gdpr   # skip prompts in scripts
Comparison of speed test tools on Ubuntu: Ookla Speedtest CLI, speedtest-cli, iperf3 and curl or wget
Which test tool to use

Option 2: The Python speedtest-cli

Available in Ubuntu's own repositories, no extra repo needed:

sudo apt install speedtest-cli
speedtest-cli                 # full output
speedtest-cli --simple        # ping, download, upload only
speedtest-cli --bytes         # show MB/s instead of Mbit/s
speedtest-cli --server 12345  # specific server

It's fine for quick checks, but it often under-reports fast connections because it's single-threaded and limited by Python's speed. If results look low on a gigabit VPS, use Ookla's CLI.

Understanding the results

  • Ping/latency: round-trip time to the test server in milliseconds. Lower is better; it mainly depends on distance.
  • Jitter: how much latency varies; important for voice, video and gaming.
  • Download and upload: in Mbit/s (megabits). Divide by 8 for megabytes per second: 800 Mbit/s ≈ 100 MB/s.
  • Packet loss: should be 0%. Any loss points to a network problem.

Results depend heavily on the test server you hit. Test against a few servers, including one near your users, and repeat at different times of day before drawing conclusions. A single result from a busy server says little about your VPS's real port speed.

Explanation of speed test results: download, upload, ping (latency), jitter and packet loss
Reading the results

Test speed between two servers with iperf3

To measure the raw link between your VPS and another machine you control, without any third-party server, use iperf3:

# on server A
sudo apt install iperf3
iperf3 -s

# on server B
iperf3 -c SERVER_A_IP -P 4       # 4 parallel streams
iperf3 -c SERVER_A_IP -R          # reverse: test the other direction

Open TCP port 5201 on server A for the test, and close it afterwards.

Diagram of an iperf3 test: one server runs iperf3 -s and the other runs iperf3 -c to measure throughput
How iperf3 tests a link

Quick download test with curl or wget

For a simple real-world check, download a large test file and watch the speed. Most hosting providers and data centres publish test files on their "looking glass" or speed-test pages:

wget -O /dev/null https://TEST-FILE-URL/1GB.bin
curl -o /dev/null -w "%{speed_download}\n" https://TEST-FILE-URL/1GB.bin

Pick a test file hosted near you; the speed shown is limited by both your server and the remote one. Writing to /dev/null keeps the file off your disk.

Troubleshooting

  • "speedtest: command not found": the package isn't installed, or you installed speedtest-cli, whose command is speedtest-cli.
  • Conflict when installing Ookla's package: remove speedtest-cli first.
  • "Cannot retrieve speedtest configuration" (Python client): outdated version; switch to Ookla's CLI.
  • Much lower speed than expected: try other servers, check CPU usage during the test, and compare with iperf3 to separate network from test-server limits.

Frequently asked questions

How do I check internet speed on Ubuntu from the terminal?

Install Ookla's speedtest CLI or the speedtest-cli package and run it; both report ping, download and upload.

Which is better, speedtest or speedtest-cli?

Ookla's official speedtest is more accurate, especially above a few hundred Mbit/s. speedtest-cli is easier to install from Ubuntu's repositories.

How do I choose a specific speed test server?

List servers with speedtest -L and run speedtest -s ID.

How do I test speed between two servers?

Run iperf3 -s on one and iperf3 -c IP on the other.

Nishant Kumar, Sr. Server Engineer at 99RDP
Written byNishant KumarSr. Server Engineer, 99RDP. Part of the team that runs our servers and answers support.
Keep reading

More Linux guides

All Linux guides

Need a server for this?

✓ Setup in minutes✓ Full admin access✓ 7-day refund on new services