user 发表于 2024-1-7 18:46:15

CentOS下用命令行测试网速

很多时候我们需要测试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.github.com/sivel/spe ... er/speedtest_cli.py
# chmod a+rx speedtest_cli.py
# mv speedtest_cli.py /usr/local/bin/speedtest-cli
# chown root:root /usr/local/bin/speedtest-cli也可以在自己电脑上下载好 speedtest_cli.py 然后上传到服务器上。二、使用speedtest-cli测试网速
使用speedtest-cli命令也很简单,它不需要任何参数即可工作。# speedtest-cli输入这个命令后,它会自动发现离你最近的Speedtest.net服务器(地理距离),然后打印出测试的网络上/下行速率。# 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) : 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
当然对于测试结果,一般在实际应用中不一定能达到这个值,仅作为参考使用。
页: [1]
查看完整版本: CentOS下用命令行测试网速