speedtest-cli

Test the server's external network speed under the command line

Supplementary instructions

speedtest-cli is a command line script written in python. It completes the speed test by calling speedtest.net to test the upstream and downstream interfaces. Finally, I will test the external network speed of the server where the operation and maintenance survival time is located. Project address: https://github.com/sivel/speedtest-cli

Install speedtest-cli

speedtest-cli needs to be in a python 2.4-3.4 environment. The installation method is very simple. Choose the one below that suits you best.

pip method

# pip install speedtest-cli

easy_install method

# easy_install speedtest-cli

github+pip method

# pip install git+https://github.com/sivel/speedtest-cli.git

or

# git clone https://github.com/sivel/speedtest-cli.git
# python speedtest-cli/setup.py install

Download script method

# wget -O speedtest-cli https://raw.github.com/sivel/spe...er/speedtest_cli.py
# chmod +x speedtest-cli

or

# curl -o speedtest-cli https://raw.github.com/sivel/spe...er/speedtest_cli.py
# chmod +x speedtest-cli

Just download the script directly and give it execution permission.

Usage

-h, --help show this help message and exit
--share Share your network speed. This command will generate a picture of the network speed test results on the speedtest website.
--simple Suppress verbose output, only show basic information
--list Displays a list of speedtest.net test servers based on distance.
--server=SERVER specifies the server id in the list for testing.
--mini=MINI URL of the Speedtest Mini server
--source=SOURCE Source ip address to bind to
--version Show the version number and exit

Example

List all test servers in China:

[root@li229-122 ~]# speedtest-cli --list | grep China
1185) China Unicom (Changchun, China) [10534.35 km]
3784) China Mobile (Urumqi, China) [10581.15 km]
2667) Beijing Normal University (Beijing, China) [11117.03 km]
2529) Beijing Normal University (Beijing, China) [11117.03 km]
2816) Capital Online Data service (Beijing, China) [11117.03 km]
4354) SXmobile (Taiyuan, China) [11383.17 km]
3973) China Telecom (Lanzhou, China) [11615.43 km]
3633) China Telecom (Shanghai, China) [11983.37 km]
3927) China Mobile Jiangsu Co., Ltd. (Suzhou, China) [11989.27 km]
2461) China Unicom (Chengdu, China) [12213.35 km]
1028) Shepherd Software (Xiamen, China) [12785.57 km]
1628) Xiamen Guangdian Xinxu (Xiamen, China) [12785.57 km]
3891) GZinternet (Guangzhou, China) [13005.36 km]
3871) SZWCDMA (Shenzhen, China) [13059.20 km]
3819) SZU (Shenzhen, China) [13059.20 km]
1536) STC (Hong Kong, China) [13088.37 km]
1890) Telin (Hong Kong, China) [13088.37 km]

Explanation of results

3633) China Telecom (Shanghai, China) [11983.37 km]
3633: server id
china telecom: isp, this is China Telecom
shanghai,china: server address
11983.37 km: The geographical distance between the two servers. My machine is in the United States, and it is 11983.37 kilometers away from Shanghai, which is very far.

External network speed test

[root@li229-122 ~]# speedtest-cli --server=3633 --share
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from Linode (173.255.219.122)...
Hosted by China Telecom (Shanghai) [11983.37 km]: 23.603 ms
Testing download speed........................................
Download: 24.84 Mbit/s
Testing upload speed................................................ ...
Upload: 4.57 Mbit/s
Share results: http://www.speedtest.net/result/3240988007.png