speedtest.net提供了一個指令行工具 speedtest-cli 我們可以在linux中使用speedtest-cli來測試寬帶速度
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