There are upcoming maintenance events which may impact our services. Learn more

How to Speedtest a Clean Linux Server Using speedtest-cli Print

  • 453

Testing your server’s uplink speed is essential to ensure it meets your performance requirements. Whether you’re troubleshooting network issues or verifying your server’s capabilities, speedtest-cli is a simple and effective tool for measuring upload and download speeds. This guide will walk you through installing and using speedtest-cli on a clean Linux server.

What is speedtest-cli?

speedtest-cli is a command-line interface for testing internet bandwidth using Speedtest.net. It’s lightweight, easy to use, and doesn’t require a graphical interface, making it ideal for servers.

Step 1: Install speedtest-cli

To install speedtest-cli, follow these steps based on your Linux distribution.

For Debian/Ubuntu:

  1. Update your package list:

    sudo apt update

  2. Install speedtest-cli:

    sudo apt install speedtest-cli

For CentOS/RHEL:

  1. Install epel-release (if not already installed):

    sudo yum install epel-release

  2. Install speedtest-cli:

    sudo yum install speedtest-cli

For Other Distributions:

If speedtest-cli isn’t available in your distribution’s package manager, you can install it using pip (Python’s package manager):

  1. Install pip (if not already installed):

    sudo apt install python3-pip (Debian/Ubuntu)

    sudo yum install python3-pip (CentOS/RHEL)

  2. Install speedtest-cli via pip:

    sudo pip3 install speedtest-cli

Step 2: Run a Speedtest

Once speedtest-cli is installed, you can run a speedtest to measure your server’s uplink and downlink speeds.

Basic Speedtest

  1. Run the following command:

    speedtest-cli

  2. Wait for the test to complete. You’ll see results like this:
    Retrieving speedtest.net configuration...
    Testing from Your ISP (Your IP)...
    Retrieving speedtest.net server list...
    Selecting best server based on ping...
    Hosted by Example Host (City, Country) [10.00 km]: 10.00 ms
    Testing download speed................................................................................
    Download: 950.00 Mbit/s
    Testing upload speed................................................................................
    Upload: 750.00 Mbit/s

Test Only Upload Speed

If you’re specifically interested in testing the uplink speed, use the --no-download flag:

  1. Run the following command:

    speedtest-cli --no-download

  2. The output will show only the upload speed:
    Retrieving speedtest.net configuration...
    Testing from Your ISP (Your IP)...
    Retrieving speedtest.net server list...
    Selecting best server based on ping...
    Hosted by Example Host (City, Country) [10.00 km]: 10.00 ms
    Testing upload speed................................................................................
    Upload: 750.00 Mbit/s

Test Only Download Speed

If you’re specifically interested in testing the downlink speed, use the --no-upload flag:

  1. Run the following command:

    speedtest-cli --no-upload

  2. The output will show only the download speed:
    Retrieving speedtest.net configuration...
    Testing from Your ISP (Your IP)...
    Retrieving speedtest.net server list...
    Selecting best server based on ping...
    Hosted by Example Host (City, Country) [10.00 km]: 10.00 ms
    Testing download speed................................................................................
    Download: 950.00 Mbit/s

Step 3: Advanced Options

speedtest-cli offers several advanced options for customizing your speedtest.

1. Test Against a Specific Server

To test against a specific server, first list all available servers:

  1. Run the following command:

    speedtest-cli --list

  2. You’ll see a list of servers with their IDs. For example:
    1234) Example Host 1 (City, Country) [10.00 km]
    5678) Example Host 2 (City, Country) [20.00 km]
  3. Run a speedtest against a specific server using its ID:

    speedtest-cli --server 1234

2. Save Results to a File

To save the speedtest results to a file, use the --share flag:

  1. Run the following command:

    speedtest-cli --share

  2. The results will be saved to a file, and you’ll receive a shareable link:
    Share results: https://www.speedtest.net/result/1234567890

3. Run a Speedtest in Bytes Instead of Bits

By default, speeds are shown in bits per second (Mbit/s). To display speeds in bytes per second (MB/s), use the --bytes flag:

  1. Run the following command:

    speedtest-cli --bytes

  2. The output will show speeds in MB/s:
    Download: 118.75 MB/s
    Upload: 93.75 MB/s

Conclusion

Using speedtest-cli, you can easily test your server’s uplink and downlink speeds to ensure it meets your performance requirements. Whether you’re troubleshooting network issues or verifying your server’s capabilities, this tool provides quick and accurate results.


Was this answer helpful?

« Back