Illegal websites should not initiate any form of manual service requests to our staff. It is strictly prohibited to use honmau Media's technical support services and products to engage in any illegal activities. If discovered, no technical support will be provided.×
Current location:home> news > help and support

How to use the Linux command line to test server bandwidth

When people notice that Internet access is slowing down, they usually first test the Internet connection speed from their computer to their Internet service provider (often referred to as the "last mile"). Among the websites available for testing broadband speeds, Speedtest.net is perhaps the most widely used.

Speedtest.net doesn't work complicated: it loads JavaScript code in your browser and automatically detects the nearest Speedtest.net server, then sends HTTP GET and POST requests to the server to test the upstream/downstream speed.

But without a graphical desktop (for example, when you log in to a server remotely from the command line or use an operating system without a graphical interface), the flash-based, user-friendly Speedtest.net will not work. Fortunately, Speedtest.net provides a command-line version-speedtest-cli. Below I will show you how to use speedtest-cli on the Linux command line to test broadband connection speeds.

Install speedtest-cli

speedtest-cli is a lightweight Linux command-line tool written in Python that runs under Python versions 2.4 to 3.4. It is based on Speedtest.net's infrastructure to measure the upstream/downstream rates of the network. Installing speedtest-cli is simple-just download its Python script files.

$ wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py


$ chmod a+rx speedtest_cli.py


$ sudo mv speedtest_cli.py /usr/local/bin/speedtest-cli


$ sudo chown root:root /usr/local/bin/speedtest-cli


Test the network speed with speedtest-cli

Using the speedtest-cli command is also simple; it does not require any parameters to work.

$ speedtest-cli

After entering this command, it will automatically discover the nearest Speedtest.net server (geographical distance) and print out the tested network uplink/downlink rate.

'如何使用Linux命令行测试服务器带宽'

If you are willing to share test results, you can use the parameter "-share". It will upload your test results to the Speedtest.net server and share them graphically with others.

'如何使用Linux命令行测试服务器带宽'

Here is a test result that was automatically generated by speedtest-cli and uploaded to Speedtest.net:

'如何使用Linux命令行测试服务器带宽'

If you are interested in all currently available Speedtest.net servers, you can use the parameter "-list". It prints out all Speedtest.net servers (sorted in order of geographical distance from you from near to far).

'如何使用Linux命令行测试服务器带宽'

In the list above, each server has an ID corresponding to it in front of it. If you want to use a specified server to test your speed, you just need to specify its ID after the speedtest-cli command. For example, if you want to use a server in Washington DC, you only need to specify the corresponding server ID (such as 935).

'如何使用Linux命令行测试服务器带宽'

© Website copyright and disclaimer

1.[honmau Media] independently owns the copyright of all materials on relevant pages of this website;

2. No one is allowed to copy it without the express written permission of [honmau Media];

3. The articles that do not indicate "honmau Media" on this website are all from the Internet and are only for everyone to learn and refer;

4. If there is any infringement/violation/irregularity, please contact customer service QQ or email to delete it, please understand;

5.[honmau Media] reserves the right to correct, modify and update this statement at any time.legal notice

Message Board
* Contact customer service for urgent issues
submitted
submission
Working days: 8:30 - 22:00 Online QQ

customer service

Company Introduction
top