SPEEDTEST-CLI is a Python tool provided by Speedtest.net, which is used to speed the network. And it can also show the results of the test as a picture of the way out. Here's a Han, Speedtest.net also offers online speed-testing on the Web, by loading JavaScript code into your browser and automatically detecting the nearest Speedtest.net server, and then sending HTTP GET and Post request to test uplink/downlink speed.
I. Installation of SPEEDTEST-CLI
SPEEDTEST-CLI is a lightweight Linux command-line tool written in Python that runs under Python2.4 to 3.4. It is based on
Speedtest.net infrastructure to measure the up/down rate of the network. Installing SPEEDTEST-CLI is simple-just download its Python script files.
The code is as follows |
Copy Code |
$ wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py $ chmod +x speedtest_cli.py Www.111cn.net
|
Add executable permissions to the script to run, and if you want to run the command directly, you can move it to the bin directory.
Second, SPEEDTEST-CLI test speed
1. Direct execution without any parameters
The code is as follows |
Copy Code |
yang@crunchbang:/tmp$ python speedtest_cli.py Retrieving Speedtest.net configuration ... Retrieving Speedtest.net server list ... Testing from Wasu TV & Communication Holding Co.,ltd. (58.100.45.111) ... Selecting best server based on ping ... Hosted by our Mobile Jiangsu Co., Ltd. (Suzhou) [124.58 km]: 17.722 ms Testing download speed ....... ...... ..... ..... ..... ..... ...... ... download:3.72 mbit/s Testing upload speed ....... ...... ...... ..... ..... ..... ..... ..... ..... ..... ... upload:3.88 mbit/s |
is not found very strong, its detection of My network is a number of network, automatically selected from my host recently located in Suzhou, Jiangsu, speedtest.net Host Test, and the results of my network on the next row output.
2, the test results through the picture to share
code is as follows |
copy code |
yang@crunchbang:/tmp$ python speedtest_cli.py--share Retrieving Speedtest.net configuration ... Retrieving Speedtest.net server list ... Testing from Wasu TV & Communication Holding Co.,ltd. (58.100.45.111) ... Selecting best server based on ping ... Hosted by Telecom (Shanghai) [168.66 km]: 16.292 ms Testing download speed ....... ...... ..... ..... ..... ..... ...... ... download:3.06 mbit/s Testing upload speed ....... ...... ...... ..... ..... ..... ..... ..... ..... ..... ... upload:1.65 mbit/s Share Results:yun_qi_img/3358961164.png |
Its output and above is no different, but at the end of a link to a picture page, the picture reads as follows:
Speedtest
3. List speedtest.net servers (in order from distance)
The code is as follows |
Copy Code |
yang@crunchbang:/tmp$ python speedtest_cli.py--list|more Retrieving Speedtest.net configuration ... Retrieving Speedtest.net server list ... 3927 Jiangsu Co., Ltd. (Suzhou, a) [124.58 km] 3633) Telecom (Shanghai) [168.66 km] 4490) Telecom Anhui Co.,ltd (Wuhu, a) [203.24 km] 4377) Anhui Co.,ltd (Hefei, a) [320.21 km] 4433) Telecom Anhui Co.,ltd (Hefei, a) [320.21 km] 4543) Fujian MCC Co., Ltd. (Fuzhou, a) [474.25 km] 3921) Taiwan Fixed Network (Taoyuan, Taiwan) [589.71 km] 2589) Far EasTone Telecommunications Co., Ltd. (Taoyuan, Taiwan) [589.71 km] 3967) Chief Telecom (Taipei, Taiwan) [600.87 km] 2133) Taiwan Fixed Network (Taipei, Taiwan) [600.87 km] 2327) Far EasTone Telecommunications Co., Ltd. (Taipei, Taiwan) [600.87 km] 2181) Kbro CO. LTD (Taipei, Taiwan) [600.87 km] |
There are more servers in the back, which are omitted from the list.
4, select the server to speed
code is as follows |
copy code |
yang@crunchbang:/tmp$ python speedtest_cli.py--server 3633 retrieving speedtest.net configuration ... retrieving speedtest.net server list ... testing from Wasu TV & Communication Holding Co.,ltd. (58.100.45.111) ... hosted by Telecom (Shanghai) [168.66 km]: 23.286 ms testing Download Speed ..... ....... ....... ....... ...... ..... ... download:3.47 mbit/s www.111cn.net testing upload speed .................................................. upload:3.67 mbit/s |
As shown in the figure above, I chose the Shanghai server for testing, and the ID value is the ID of the server we view with the list parameter.