speedtest-cli:一个流行的linux命令行下测速工具

speedtest-cli是speedtest.net下制作的测试linux系统的网络速度的一款小工具,基于python语言,满足了命令行下对网络测试的需求。

安装方法

speedtest有多种安装方法。

1、pip/easy_install

需要你已经安装了python环境

pip install speedtest-cli

easy_install speedtest-cli

2、github

需要先安装pip。

pip install git+https://github.com/sivel/speedtest-cli.git

3、直接下载

需要先安装wget

wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli

需要先安装curl

curl -Lo speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli

4、ubuntu / debian

这两个系统可以直接安装speedtest工具

apt-get install speedtest -y

使用方法:直接输入speedtest 就可以了,参数都一样。个人测试这样的安装方法在国内服务器测速不准,100M的宽带上传不到10M。还是建议使用前三种安装方法。

用法

进入脚本所在目录,只需要一个命令就可以跑了。

./speedtest-cli

如果你要分享测速结果,加上share参数,测速完成后会给出一个地址

./speedtest-cli --share

图片示例:

speedtest-cli:一个流行的linux命令行下测速工具-懵比小站

如果你想要只测下载,不需要上传

./speedtest-cli --no-upload

如果只要上传不要下载

./speedtest-cli --no-download

以MB位单位显示结果。Mbyte/s跟我们所说的MB单位一致

./speedtest-cli --bytes

默认工具会选择ping值最低的测速点进行测速,我们可以手动选择测速点。

./speedtest-cli --server

参数server后跟的是节点id,节点id使用list参数寻找

./speedtest-cli --list

list参数会列出speedtest所有的测速节点,非常多,所以我们加上grep命令做筛选,区分大小写。

./speedtest-cli --list | grep China

下面是中国的测速节点信息(非全部)

17223) chinamobile, hebei (Shijiazhuang, CN) [534.97 km]
 5317) China Telecom JiangSu 5G (Lianyungang, China) [94.25 km]
27100) ShanDong CMCC 5G (Qingdao, China) [107.48 km]
27151) ShanDong CMCC 5G (Linyi, China) [111.11 km]
31648) sercomm (Suzhou, China) [246.28 km]
 5396) China Telecom JiangSu 5G (Suzhou, China) [246.28 km]
 5039) China unicom Jinan branch (Jinan, China) [268.98 km]
26180) Shandong Unicom 5G (Jinan, China) [268.98 km]
25881) ShanDong CMCC 5G (Jinan, China) [268.98 km]
13704) China Unicom (Nanjing, China) [376.85 km]
27249) China Mobile jiangsu 5G (Nanjing, China) [376.85 km]
26352) China Telecom JiangSu 5G (Nanjing, China) [378.47 km]
21845) China Mobile 5G (ChangZhou, China) [400.57 km]
26850) China Mobile 5G (Wuxi, China) [431.60 km]
25728) ChinaMobile, Liaoning Branch,Dalian (Dalian, China) [432.84 km]
17145) China Telecom AnHui 5G (Hefei, CN) [443.86 km]
26404) 安徽移动5G (Hefei, China) [443.86 km]
 5724) ChinaUnicom (Hefei, China) [443.86 km]
27154) ChinaUnicom-5G (TianJin, China) [464.58 km]
30852) Duke Kunshan University (Kunshan, China) [465.71 km]
17184) China Mobile TianJin-5G (Tianjin, CN) [478.97 km]
21005) China Unicom (Shanghai, China) [501.10 km]
 3633) China Telecom (Shanghai, China) [501.10 km]
30154) SH-ChinaMobile (Shanghai, China) [501.10 km]
24447) China Unicom 5G (ShangHai, China) [501.10 km]
25637) Chinamobile-5G (Shanghai, China) [501.10 km]
26331) Henan CMCC 5G (Zhengzhou, China) [541.87 km]
25858) China Mobile Group Beijing Co.Ltd (Beijing, China) [573.27 km]
 5145) Beijing Unicom (Beijing, China) [573.27 km]
 5505) Beijing Broadband Network (Beijing, China) [573.27 km]
27377) China Telecom 5G (Beijing, China) [573.27 km]
 4647) China Mobile Group Zhejiang Co.,Ltd (Hangzhou, China) [575.14 km]
 7509) China Telecom ZheJiang Branch (Hangzhou, China) [575.14 km]
 6715) China Mobile Zhejiang 5G (Ningbo, China) [643.12 km]
26501) shanxi CMCC 5G (Taiyuan, China) [679.65 km]
29353) wuhan hello 5G (Wuhan, China) [724.61 km]
23844) China Telecom Wuhan Branch (Wuhan, China) [724.61 km]
 5485) China Unicom,Hubei Branch (Wuhan, China) [724.61 km]
16167) ChinaMobile, Liaoning Branch (Shenyang, China) [799.87 km]
25883) 江西移动5G (NanChang, China) [822.35 km]
30232) NeiMeng CMCC 5G (Hohhot, China) [910.30 km]
24012) China Telecom Inner Mongolia Branch-1 (Huhhot, China) [910.30 km]
30293) Neimeng CMCC 5G (Tongliao, China) [947.24 km]
26380) Shaanxi china mobile (xi‘an, China) [972.53 km]
 4863) Xi'an branch,Chinaunicom (Xi'an, China) [977.59 km]
29105) 陕西移动5G (Xi'an, China) [977.59 km]
28491) China Mobile HuNan 5G (ChangSha, China) [1009.07 km]
 4870) Changsha, Hunan Unicom,Server1 (Changsha, China) [1011.57 km]
28225) Hunan Telecom 5G (Changsha, China) [1011.57 km]
26677) Changsha, Hunan Unicom (Zhuzhou, China) [1035.95 km]
 4884) China Unicom FuJian (Fuzhou, China) [1036.36 km]
16171) Fuzhou China Mobile,Fujian (Fuzhou, China) [1036.36 km]
16375) China Mobile,Jilin (Changchun, China) [1065.41 km]
 9484) China Unicom (Changchun, China) [1065.41 km]
26940) ChinaMobile,Ningxia (Yinchuan, China) [1229.44 km]
31815) vixtel (Yinchuan city, China) [1229.44 km]
 5509) Chinaunicom Ningxia branch (Ningxia, China) [1283.95 km]
26656) ChinaMobile-HeiLongjiang (Harbin, China) [1297.23 km]
31985) China Unicom (Chongqing, China) [1376.45 km]
19076) China Telecom (Chongqing, China) [1376.45 km]
 5530) CCN (Chongqing, China) [1376.45 km]
 4690) China Unicom Lanzhou Branch Co.Ltd (Lanzhou, China) [1420.17 km]
16145) Lanzhou,China Mobile,Gansu (Lanzhou, China) [1420.17 km]
 3973) China Telecom (Lanzhou, China) [1420.17 km]
26678) Guangzhou Unicom 5G (Guangzhou, China) [1491.58 km]
 6611) China Mobile,Guangdong (Guangzhou, China) [1491.58 km]
27594) ChinaTelecom 5G (Guangzhou, China) [1491.58 km]
16192) ShenZhen Unicom (ShenZhen, China) [1522.59 km]
 4515) China Mobile,Guangdong (Shenzhen, China) [1522.59 km]
 2461) China Unicom (Chengdu, China) [1532.63 km]
24337) China Mobile Group Sichuan Co.,Ltd. (Chengdu, China) [1532.63 km]
29026) 四川电信 (Chengdu, China) [1532.63 km]
29071) 四川电信 (成都, China) [1536.38 km]
31520) GMCC (Zhongshan, China) [1550.30 km]
 1536) STC (Hong Kong, China) [1551.34 km]
 2993) Website Solution Limited (Hong Kong, China) [1551.34 km]
16398) China Mobile,GuiZhou (Guiyang, China) [1564.39 km]
29083) qh_5g_speedtest (Xining, China) [1600.07 km]
15863) GX ChinaMobile (Nanning, China) [1769.80 km]
27810) GX-Telecom (Nanning, China) [1769.80 km]
16503) Chinamobile,Hainan (Haikou, China) [1929.28 km]
 5103) Yunnan Chinaunicom (Kunming, China) [1979.51 km]
26728) ChinaMobile (Kunming, China) [1979.51 km]
18444) China Mobile Group Tibet (Lhasa, China) [2730.53 km]
 6144) xjunicom (Urumqi, China) [2869.08 km]
26938) Urumqi CMCC 5G (Urumqi, China) [2869.08 km]
16858) China Mobile Group XinJiang (Urumqi, China) [2869.08 km]
27575) XinJiang Telecom Cloud (Urumqi, China) [2869.08 km]
17222) China Mobile Group XinJiang (Aletai, China) [2925.26 km]
17227) China Mobile Group XinJiang (Hetian, China) [3530.68 km]
17245) China Mobile Group XinJiang (Kashi, China) [3833.20 km]

例如我要使用上海节点测速,看看服务器到上海的网络情况

./speedtest-cli --server 21005 --share

测试结果:

speedtest-cli:一个流行的linux命令行下测速工具-懵比小站

本文系作者 @ 原创发布在 懵比小站。未经许可,禁止转载。

喜欢()
评论 (0)
热门搜索
homeagain
分享互联网最新资讯,分布各类教程:苹果cms、vps推荐、宝塔建站知识、edu邮箱、wordpress模板下载……只有你想不到,没有出不了的教程。
235 文章
166 评论
63 喜欢
Top