Linux Command Line Test speed
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.
$ 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
Use speedtest-cli to test the network speed
Using the speedtest-cli command is also simple, and it can work without any parameters.
$ 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 ).