speedtest-cli是由Python編寫的輕量級Linux命令行工具基於Speedtest.net的基礎架構來測量網絡的上/下行速率
運行環境:Python2.4-3.4
github:https://github.com/sivel/speedtest-cli
下載speedtest-cli.py 並更改權限
# wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
# chmod a+rx speedtest_cli.py
使用speedtest-cli
# speedtest-cli
# 下方內容爲回顯內容(整個過程需要花上一點時間)
*****************************************************************
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from China Unicom ####### (0.0.0.0)...
Selecting best server based on ping...
Hosted by Vladlink (Vladivostok) [509.76 km]: 14.623 ms
Testing download speed........................................
Download: 2.10 Mbit/s
Testing upload speed..................................................
Upload: 0.41 Mbit/s
*****************************************************************
# speedtest-cli -h
usage: speedtest-cli [-h] [--share] [--simple] [--list] [--server SERVER]
[--mini MINI] [--source SOURCE] [--version]
Command line interface for testing internet bandwidth using speedtest.net.
--------------------------------------------------------------------------
https://github.com/sivel/speedtest-cli
optional arguments:
-h, --help show this help message and exit
--share Generate and provide a URL to the speedtest.net share
results image
--simple Suppress verbose output, only show basic information
--list Display a list of speedtest.net servers sorted by distance
--server SERVER Specify a server ID to test against
--mini MINI URL of the Speedtest Mini server
--source SOURCE Source IP address to bind to
--version Show the version number and exit
#如果想方便的使用speedtest-cli 可以對speedtest-cli.py進行如下操作
# sudo mv speedtest_cli.py /usr/local/bin/speedtest-cli
# sudo chown root:root /usr/local/bin/speedtest-cli
文章轉載自:http://linux.it.net.cn/CentOS/fast/2015/0311/13862.html