When you find that the Internet access speed slows down, people usually first test their computer's network connection speed to the network service provider (usually called the last kilometer. Speedtest.net may be the most widely used website to test the bandwidth speed. Working Linux commands of Speedtest.net
When you find that the Internet access speed slows down, people usually first test their computer's network connection speed to the network service provider (usually known as the "last mile. Speedtest.net may be the most widely used website to test the bandwidth speed.
The working principle of Speedtest.net is not complex: it loads JavaScript code in your browser and automatically detects the nearest Speedtest.net server, then, send an http get and POST request to the server to test the uplink/downlink network speed.
But when there is no graphical desktop (for example, when you remotely log on to the server through the command line or use an operating system without a graphical interface), Speedtest.net based on flash and user-friendly will not work. Fortunately, Speedtest.net provides a command line version-speedtest-cli. Next I will show you how to use speedtest-cli in Linux command line to test the bandwidth connection speed.
Install speedtest-cli
Speedtest-cli is a lightweight Linux command line tool written in Python. it can be run from Python 3.4 to Python. It is based on the infrastructure of Speedtest.net to measure the uplink/downlink speed of the network. Installing speedtest-cli is simple-you only need to download its Python script file.
1 $ wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
2 $ chmod a + rx speedtest_cli.py
3 $ sudo mv speedtest_cli.py/usr/local/bin/speedtest-cli
4 $ sudo chown root: root/usr/local/bin/speedtest-cli
Use speedtest-cli to test the network speed
Using the speedtest-cli command is also simple, and it can work without any parameters.
1 $ speedtest-cli
After you enter this command, it will automatically find the nearest Speedtest.net server (geographic distance), and then print the network/downlink rate of the test.
If you want to share the test results, you can use the "-share" parameter ". It will upload your test results to the Speedtest.net server and share them with others in graphics.
The following is a test result automatically generated by speedtest-cli and uploaded to Speedtest.net:
If you are interested in all the currently available Speedtest.net servers, you can use the "-list" parameter ". It will print out all the Speedtest.net servers (sorted by distance from your location ).
In the above list, each server has a corresponding ID before it. If you want to use the specified server to test your network speed, you only 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 ).