Linux命令列測試網速

來源:互聯網
上載者:User

Linux命令列測試網速

很多時候我們需要測試Linux伺服器的上行和下行寬頻。在可用於測試寬頻速度的網站中,Speedtest.net也許是使用最廣泛的應用“之一”。
Speedtest.net提供了一個命令列版本——speedtest-cli。下面將向你示範如何在Linux的命令列中使用speedtest-cli來測試寬頻連線速度。

一、安裝speedtest-cli
speedtest-cli是一個用Python編寫的輕量級Linux命令列工具,在Python2.4至3.4版本下均可運行。它基於Speedtest.net的基礎架構來測量網路的上/下行速率。安裝speedtest-cli很簡單——只需要下載其Python指令檔。網上的教程非常古老,用了只會報到期指令碼 ,更新如下

wgethttps://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py

chmod a+rx speedtest.py

mv speedtest.py /usr/local/bin/speedtest-cli

chown root:root /usr/local/bin/speedtest-cli

speedtest-cli

也可以在自己電腦上下載好 speedtest.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
當然對於測試結果,一般在實際應用中不一定能達到這個值,僅作為參考使用。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.