Linux命令行测试网速

您所在的位置:网站首页 linux测网速命令 Linux命令行测试网速

Linux命令行测试网速

2023-09-03 20:13| 来源: 网络整理| 查看: 265

       很多时候我们需要测试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脚本文件。网上的教程非常古老,用了只会报过期脚本 ,更新如下

wget https://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  当然对于测试结果,一般在实际应用中不一定能达到这个值,仅作为参考使用。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3