A. 如何使用Linux命令行測試網速
一、安裝speedtest-cli
speedtest-cli是一個用Python編寫的輕量級Linux命令行工具,在Python2.4至3.4版本下均可運行。它基於Speedtest.net的基礎架構來測量網路的上/下行速率。安裝speedtest-cli很簡單——只需要下載其Python腳本文件。
[root@localhost temp]# wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
[root@localhost temp]# chmod a+rx speedtest_cli.py
[root@localhost temp]# mv speedtest_cli.py /usr/local/bin/speedtest-cli
[root@localhost temp]# chown root:root /usr/local/bin/speedtest-cli
也可以在自己電腦上下載好 speedtest_cli.py 然後上傳到伺服器上。
二、使用speedtest-cli測試網速
使用speedtest-cli命令也很簡單,它不需要任何參數即可工作。
[root@localhost temp]# speedtest-cli
輸入這個命令後,它會自動發現離你最近的Speedtest.net伺服器(地理距離),然後列印出測試的網路上/下行速率。
[root@localhost temp]# speedtest-cli
Retrieving speedtest.net configuration…
Retrieving speedtest.net server list…
Testing from China Telecom (219.135.214.145)…
Selecting best server based on latency…
Hosted by CTM Internet Services (Macau) [106.48 km]: 55.974 ms
Testing download speed………………………………….
Download: 3.15 Mbit/s
Testing upload speed…………………………………………..
Upload: 0.58 Mbit/s
測試結果說明:上行為 0.58Mbit/s 下行為 3.15 Mbit/s