Linux入门教程:CentOS下使用speedtest.net测速,
Linux入门教程:CentOS下使用speedtest.net测速,
我们都知道windows下可以直接用浏览器访问www.speedtest.net来进行测速
但是我们从vps上怎么用呢 不要紧speedtest-cli来帮你忙
项目地址 https://github.com/sivel/speedtest-cli 有兴趣可以看一下
先来个一键脚本
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py --no-check-certificate
chmod +x speedtest-cli
./speedtest-cli
安装
1、下载安装
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py --no-check-certificate
chmod +x speedtest-cli
or
curl -Lo speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py --no-check-certificate
chmod +x speedtest-cli
pip / easy_install
pip install speedtest-cli
or
easy_install speedtest-cli
Github
pip install git+https://github.com/sivel/speedtest-cli.git
or
git clone https://github.com/sivel/speedtest-cli.git
python speedtest-cli/setup.py install
下面来说使用 使用就更简单了 直接
./speedtest.py
speedtest-cli 会搜索距离你最近的服务器进行测试(物理距离最近)
结果如下 下行33Mbps 上行不到1Mbps
[root@MyServer ~]# ./speedtest-cli
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from CNISP-Union Technology (Beijing) Co. (42.51.16.74)...
Selecting best server based on latency...
Hosted by China unicom henan branch (Zhengzhou) [14.17 km]: 4.906 ms
Testing download speed........................................
Download: 33.41 Mbit/s
Testing upload speed..................................................
Upload: 0.77 Mbit/s
其实还有一些高级玩法
比如
speedtest-cli [-h] [--bytes] [--share] [--simple] [--list]
[--server SERVER] [--mini MINI] [--source SOURCE]
[--timeout TIMEOUT] [--secure] [--version]
-h, –help 显示帮助
–bytes 生成结果以字节显示(并不影响–share生成的图片)
–share 生成结果保存在speedtest服务器上并保存为图片链接
–simple 禁止详细输出,仅显示基本信息
–list 列出所有服务器ID
–server SERVER 指定一个服务器ID
–mini 指定你自己上传的speedtest mini客户端
–source SOURCE Source IP address to bind to
–timeout TIMEOUT HTTP timeout in seconds. Default 10
–secure Use HTTPS instead of HTTP when communicating with speedtest.net operated servers
–version Show the version number and exit
大多用到的功能就是 –server **** 和–share 了
服务器列表可以访问 https://www.speedtest.net/speedtest-servers-static.php
获取一下 Ctrl+F搜索你想测试的服务器吧 后面有个4位数的是ID
比如用郑州电信服务器测试 ID4595 并且生成图片
./speedtest-cli --server 4595 --share
结果如下
[root@MyServer ~]# ./speedtest-cli --server 4595 --share
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from CNISP-Union Technology (Beijing) Co. (42.51.16.74)...
Hosted by China Telecom HeNan Branch (Zhengzhou) [14.17 km]: 76.243 ms
Testing download speed........................................
Download: 33.25 Mbit/s
Testing upload speed..................................................
Upload: 0.69 Mbit/s
Share results: http://www.speedtest.net/result/5802066888.png
评论暂时关闭