Why Skip the Web-Based Speed Test
Browser-based speed test sites are convenient but noisy: they load ad networks, JavaScript trackers, and a rendering-heavy UI before a single packet of the actual test even starts, all of which competes for bandwidth and CPU on a phone. A CLI-based speed test talks directly to a test server with minimal overhead, giving you a cleaner and more repeatable measurement of latency, jitter, download, and upload throughput — genuinely useful when you're debugging a flaky mobile connection or verifying carrier-advertised speeds while on the move.
Option 1: Speedtest CLI (Ookla) via Termux
Ookla, the company behind speedtest.net, publishes an official command-line client. On Android, the cleanest way to run it is inside Termux, a terminal emulator that gives you a real Linux-style environment without root.
- Install Termux from F-Droid (the Play Store version is outdated and no longer maintained by the developer).
- Open Termux and update its package index:
pkg update && pkg upgrade
- Install curl and add Ookla's official repository, since Speedtest CLI isn't in Termux's default package list:
pkg install curl
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash
pkg install speedtest
- Accept the license on first run and execute the test:
speedtest
This prints your ISP, the selected test server, ping latency, jitter, download, and upload speeds, plus a shareable result URL by default.
Useful Speedtest CLI Flags
# Output as machine-readable JSON, useful for logging/scripting
speedtest -f json
# Pick a specific server by ID instead of the auto-selected nearest one
speedtest -s 12345
# List nearby servers to find an ID
speedtest -L
# Skip the upload test to save mobile data
speedtest --no-upload
Option 2: iperf3 for Controlled, Server-Side Testing
Speedtest.net-style tools measure against a third-party server and can be affected by that server's own load. If you control a server (a VPS, a home server on a fixed connection, or an office server), iperf3 gives you a more controlled point-to-point measurement between your phone and a server you trust.
- On the server side, start an iperf3 listener:
iperf3 -s
- In Termux on the phone, install and run the client against that server's IP:
pkg install iperf3
iperf3 -c 203.0.113.10
- To test upload speed specifically (from the server's perspective, i.e. download for your phone reversed), add
-Rto reverse the direction:
iperf3 -c 203.0.113.10 -R
iperf3 reports raw throughput in Mbits/sec across the test duration (10 seconds by default), which is a purer bandwidth measurement than a speed test site since there's no HTTP overhead or CDN-level caching involved.
Option 3: fast.com CLI (Netflix's fast-cli, via Termux/Node)
Netflix's fast.com backend measures real download throughput against Netflix's own CDN, which is a reasonable proxy for streaming performance specifically. A community-maintained fast-cli npm package wraps it for terminal use:
pkg install nodejs
npm install --global fast-cli
fast
Add -u for upload speed alongside download, since fast.com's default output is download-only:
fast -u
Reading the Results
- Ping (latency): Time in milliseconds for a packet to reach the server and back. Under 30ms is excellent for local servers, 30-80ms is normal for typical broadband/mobile, and anything consistently above 150ms will feel laggy for video calls and gaming.
- Jitter: Variation in ping between consecutive packets. High jitter (10ms+) causes choppy voice/video calls even when average latency looks fine, since packets arrive at inconsistent intervals.
- Download/Upload: Raw throughput in Mbps. Mobile carriers typically advertise peak theoretical speeds; real-world results, especially indoors or on a congested cell tower, will usually be meaningfully lower.
Logging Results Over Time
To track connection quality over a day or week instead of a single snapshot, append JSON output to a log file with a cron-like loop or Termux's termux-job-scheduler:
speedtest -f json >> ~/speedtest_log.jsonl
Each run appends a new JSON line, which you can later parse with a tool like jq to chart download/upload trends against time of day.
Discussion & Insights