How to Test Internet Speed on a Linux Server

June 13, 2026 · 7 min read · Device-Specific Testing

Test your Linux server's internet speed from the command line using Speedtest CLI, iperf3, and other tools.

If you manage a Linux server, you've probably wondered how fast its connection really is. Unlike your laptop, servers don't have a browser where you can click a button. You need command-line tools instead. This guide walks you through several ways to test internet speed directly from your Linux terminal.

Why Test Speed on a Linux Server?

Your server's internet speed affects everything it does — serving web pages, handling API requests, transferring backups, and streaming data. A slow connection means slow performance for everyone who depends on that server.

Common Reasons to Run a Test

  • Verifying your hosting plan — You're paying for 1 Gbps, but are you actually getting it?
  • Troubleshooting slow transfers — File uploads or downloads are taking longer than expected.
  • Comparing providers — You're considering switching hosts and want real numbers.
  • Monitoring over time — You want to track if speeds drop during peak hours.

If you're curious about what speeds you should expect, check out our guide on what counts as a good download speed.

Method 1: Speedtest CLI (Ookla)

The most popular option is Speedtest CLI from Ookla. It's the same engine behind most browser-based speed tests, but it runs entirely in your terminal. It measures download speed, upload speed, and ping.

Installation

On Ubuntu or Debian-based systems, run these commands:

  1. Install the required package: sudo apt install curl
  2. Add the Ookla repository: curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
  3. Install the tool: sudo apt install speedtest

On CentOS, RHEL, or Fedora, replace apt with dnf or yum and use the corresponding RPM repository script from Ookla's site.

Running the Test

Simply type speedtest and press Enter. You'll see output like this:

  • Server: Your nearest test server (with location)
  • Latency: 3.42 ms
  • Download: 892.15 Mbps
  • Upload: 456.23 Mbps

You can also pick a specific server with speedtest --server-id=12345 or output results as JSON with speedtest --format=json. The JSON option is great for logging results to a file automatically.

Method 2: Other Command-Line Tools

Speedtest CLI isn't your only option. Several other tools work well, and each has its strengths. Here's a breakdown.

iperf3 — Test Between Two Servers

iperf3 measures the bandwidth between two specific machines. This is different from a typical speed test because it doesn't test your connection to the wider internet. Instead, it tests the raw throughput between point A and point B. Install it with sudo apt install iperf3.

On the receiving end, run iperf3 -s to start the server. On the sending end, run iperf3 -c [server-ip]. You'll get results showing bandwidth, typically very close to your network's actual capacity since there's no middleman.

curl — Quick Download Test

You can use curl for a rough download speed estimate. Run curl -o /dev/null -w "%{speed_download}" https://speed.hetzner.de/100MB.bin and it'll show you the download rate in bytes per second. Divide by 125,000 to convert to Mbps. It's not as accurate as a full test, but it works in a pinch.

fast-cli — Netflix's Tool

fast-cli uses Netflix's Fast.com servers. Install it with npm install -g fast-cli (you'll need Node.js). Then just type fast --upload to test both directions. It's simple but sometimes less consistent on servers than Speedtest CLI.

For a deeper look at what affects connection quality beyond raw speed, try running a ping test or a packet loss test to get the full picture.

Comparing the Tools

Each tool has trade-offs. Here's how they stack up for common server testing needs.

Tool Measures Max Tested Speed JSON Output Best For
Speedtest CLI Download, Upload, Ping 10 Gbps Yes General internet speed
iperf3 Bandwidth (both ways) 100 Gbps+ Yes Server-to-server throughput
curl Download only Varies by file host No Quick one-off checks
fast-cli Download, Upload ~10 Gbps No Netflix route testing

For most people, Speedtest CLI is the go-to choice. Use iperf3 when you need to measure the link between two machines you control, like testing transfer speeds between your app server and database server.

How to Automate Speed Tests

Running a single test tells you what's happening right now. But server speeds can change throughout the day. Setting up automated tests gives you much better data to work with.

Using Cron Jobs

You can schedule Speedtest CLI to run every hour with a cron job — a built-in Linux scheduler. Open your cron editor with crontab -e and add this line:

0 * * * * /usr/bin/speedtest --format=json >> /var/log/speedtest.log 2>&1

This runs a test at the top of every hour and saves the JSON results to a log file. After a few days, you'll have a clear picture of your speed patterns.

Parsing the Results

Since the output is JSON, you can use tools like jq to pull specific values. For example, to extract just the download speed from your log:

cat /var/log/speedtest.log | jq '.download.bandwidth'

The bandwidth value is in bytes per second. Multiply by 8 and divide by 1,000,000 to get Mbps. If you're seeing numbers far below what you're paying for, it might be time to look into why your speed is lower than your plan.

Tips for Getting Accurate Results

Speed tests on servers can be misleading if you're not careful. Here's how to get numbers you can trust.

Reduce Interference

  • Stop other transfers first. If your server is running backups, serving heavy traffic, or syncing files, those activities eat bandwidth and skew your results. Test during quiet periods.
  • Test multiple times. A single test can be a fluke. Run at least 3 tests and average the results. If you see big swings — say, 400 Mbps one moment and 850 Mbps the next — something else is using your connection.
  • Pick the right server. Speedtest CLI auto-selects the nearest test server, but "nearest" isn't always best. Try 2–3 different test servers and see if results are consistent.

Understand What You're Measuring

A speed test from your server to a test node measures the path between those two points. It doesn't guarantee your users in another country will experience the same speed. Geography, routing, and peering agreements all play a role.

Also, keep in mind that many hosting providers advertise "1 Gbps port speed." That's the maximum capacity of the physical connection, not a guaranteed throughput. Shared hosting environments split that bandwidth among many customers. Typical real-world results on a shared 1 Gbps connection range from 200–800 Mbps depending on the provider and time of day.

Don't Forget Latency

Raw speed isn't the only thing that matters. If your server has high latency (the time it takes for data to make a round trip), it'll feel slow even with fast download speeds. A good server should have under 10 ms latency to its test server. Anything over 50 ms to a nearby node suggests a routing problem. Learn more about what latency means and how it affects performance.

Quick Summary

Testing internet speed on a Linux server is straightforward once you know the tools. Install Speedtest CLI for the easiest all-around test. Use iperf3 to measure bandwidth between two machines you control. Set up a cron job to log results over time so you can spot trends. Always run multiple tests, pick different servers, and check latency alongside raw speed. If your numbers consistently fall short of what your host promises, you'll have the data to back up a support ticket — or a decision to switch providers.

Related Posts