2015年9月16日 星期三

Speedtest-cli.py 測試 (Linux下使用Command 做 Speedtest)

http://www.speedtest.net/ 這個網站相信就算平時不怎麼懂網路的人,也會知道。這是一個很有名的測速網站。 你的網速如何,從這兒可以得到一個很準確的參考。可是這個是GUI介面,用Browser的,現在介紹一下如果在Linux的Command Line底下,怎樣使用Speedtest.net做測試。

首先你要有 speedtest-cli.py 這個程式。可以參考以下網址:
https://pypi.python.org/pypi/speedtest-cli/

又或是懶點

wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py
chmod +x speedtest-cli

或者沒wget的話

curl -Lo speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py
chmod +x speedtest-cli

這東西是用 Python寫成的,所以你要有Python安裝在你的電腦或服務器上。一般Mac和CentOS用戶,預設應有Python,所以不用太擔心。

請使用 python -V 或 python --version 去檢查版本, speedtest-cli 需要 python 2.4以上版本。

輸入 ./speedtest-cli去執行,不輸入任何參數的話,他會去找最接近(最快)的服務器去測試。


你也可以輸入 speedtest-cli --server [SERVER_ID] 去指定測試Server,至於ID,你可以使用 speedtest-cli --list 去 Retrieve出來。



我是比較喜歡 http://www.speedtest.net/speedtest-servers.php  去查找需要的Server。

 用用看吧,很方便呢。



Google