speedtest-cli 命令测试服务器下载上传速度

想看看你手上的服务器外网的下载上传速度怎样吗? speedtest-cli 命令可以满足你的要求…

speedtest-cli 命令是 OOKLA 公司下的服务…

其公司下还有我们常用到的 speedtest 服务…

相信很多人测试电脑或手机网速的时候用过…测试数据还是值得参考的…

文章最后有惊喜…

安装speedtest-cli

要求在python 2.4以上的环境下安装..

可以先使用命令查看python的版本(如未安装可以先安装):

python -V

下面提供多种安装方式…

pip方式

pip install speedtest-cli

easy_install方式

easy_install speedtest-cli

github+pip方式

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

或者

git clone https://github.com/sivel/speedtest-cli.git

python speedtest-cli/setup.py install

下载脚本方式(推荐!比较简单)

wget --no-check 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

然后可以清楚地看到Download(下载)..Upload(上传)信息…

想要生成下面的图片分享给好友..可以使用以下命令测速后生成一个图片链接分享…

speedtest-cli --share

(用的国外服务器测试的)

如还要试用更多功能请往下看…

 

帮助命令

speedtest-cli --help
-h, --help show this help message and exit
--share 分享你的网速,该命令会在speedtest网站上生成网速测试结果的图片。 
--simple Suppress verbose output, only show basic information 
--list 根据距离显示speedtest.net的测试服务器列表。 
--server=SERVER 指定列表中id的服务器来做测试。 
--mini=MINI URL of the Speedtest Mini server 
--source=SOURCE Source ip address to bind to 
--version Show the version number and exit

 

列出所有在中国的测试服务器:

root@debian:~# speedtest-cli --list | grep China
 5460) China Unicom Heilongjiang Branch (Harbin, China) [9010.98 km]
 9484) China Unicom (Changchun, China) [9225.55 km]
 5017) China Unicom,Liaoning Branch (Shenyang, China) [9472.79 km]
 4751) Beijing Telecom (Beijing, China) [10060.92 km]
 5145) Beijing Unicom (Beijing, China) [10060.92 km]
 6302) Beijing Fiber City (Beijing, China) [10060.92 km]
 5505) Beijing Broadband Network (Beijing, China) [10060.92 km]
 5475) China Unicom (Tianjin, China) [10078.51 km]
12512) nmzl (Huhehaote, China) [10240.90 km]
 5465) China Unicom (Hohhot, China) [10248.45 km]
 5039) China unicom Jinan branch (Jinan, China) [10291.10 km]
 5563) JINAN Wo China company (Jinan, China) [10291.10 km]
12538) SHANDONG UNICOM (Jinan, China) [10291.10 km]
 3633) China Telecom (Shanghai, China) [10433.67 km]
 4665) China Mobile Group Shanghai Co.,LTD (Shanghai, China) [10433.67 km]
 5083) Shanghai Branch, China Unicom (Shanghai, China) [10433.67 km]
12868) China unicom shanxi branch (Taiyuan, China) [10450.49 km]
 3927) China Mobile Jiangsu Co., Ltd. (Suzhou, China) [10485.70 km]
 5122) China Mobile Group Jiangsu Co.,Ltd. (Wuxi, China) [10486.33 km]
 6715) China Mobile Group Zhejiang Co., Ltd. (Ningbo, China) [10533.42 km]
13704) China Unicom (Nanjing, China) [10547.25 km]
 5446) CHINA UNICOM JIANGSU COMPANY (Nanjing, China) [10550.04 km]
 4647) China Mobile Group Zhejiang Co.,Ltd (Hangzhou, China) [10598.60 km]
12278) China Mobile Group Zhejiang Branch (Hangzhou, China) [10598.60 km]
 7509) China Telecom ZheJiang Branch (Hangzhou, China) [10598.60 km]
 5300) Hangzhou , Zhejiang Unicom (Hangzhou, China) [10598.60 km]
 5131) China unicom henan branch (Zhengzhou, China) [10649.36 km]
 4595) China Telecom HeNan Branch (Zhengzhou, China) [10649.36 km]
 5724) ChinaUnicom (Hefei, China) [10661.63 km]
 4377) China Mobile Group Anhui Co.,Ltd (Hefei, China) [10661.63 km]
 5509) Chinaunicom Ningxia branch (Ningxia, China) [10953.93 km]
 5485) China Unicom,Hubei Branch (Wuhan, China) [10959.61 km]
 4863) Xi'an branch,Chinaunicom (Xi'an, China) [10968.76 km]
 5292) China Mobile Group Shaanxi Company Limited (Xi'an, China) [10968.76 km]
 6144) xjunicom (Urumqi, China) [10970.72 km]
 6435) china Telecom hubei branch (Xiangyang, China) [10973.17 km]
12637) China Telecom Xiangyang Branch (XiangYang, China) [10973.17 km]
 7230) China Unicom.JiangXi Co.,Ltd (Nanchang, China) [11011.93 km]
 5097) Chinaunicom.jx (Nanchang, China) [11011.93 km]
 4690) China Unicom Lanzhou Branch Co.Ltd (Lanzhou, China) [11083.36 km]
 5992) Qinghai China Unicom (Xining, China) [11128.33 km]
 6132) ChinaTelecom.Hunan (Changsha, China) [11242.68 km]
 4870) Changsha, Hunan Unicom (Changsha, China) [11242.68 km]
 6592) China Telecom Chongqing (Chongqing, China) [11518.36 km]
 5726) China Unicom Chong Qing Branch (Chongqing, China) [11518.36 km]
11444) University of Electronic Science and Technology of China (Chengdu, China) [11560.94 km]
 2461) China Unicom (Chengdu, China) [11560.94 km]
 4624) ChinaTelecom (Chengdu, China) [11560.94 km]
 4575) China Mobile Group Sichuan (Chengdu, China) [11560.94 km]
 6852) FPT Telecom (Chai Wan, China) [11647.24 km]
 2993) Website Solution Limited (Hong Kong, China) [11653.99 km]
10267) Interoute VDC (Hong Kong, China) [11653.99 km]
12990) QTS Data Centers (Hong Kong, China) [11653.99 km]
 1536) STC (Hong Kong, China) [11653.99 km]
 8170) Atombase Global Datamation (Hong Kong, China) [11653.99 km]
10305) GX-Telecom (Nanning, China) [12000.94 km]
 5674) GX-Unicom (Nanning, China) [12000.94 km]
 5103) Yunnan Chinaunicom (Kunming, China) [12147.82 km]
 6168) China Telecom (Kunming, China) [12147.82 km]
 5750) Lhasaunicom (Lhasa, China) [12289.49 km]

 

服务器在指定节点测试:

root@debian:~# speedtest-cli --server=5083 --share
Retrieving speedtest.net configuration...
Testing from IT7 Networks (123.123.123)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Shanghai Branch, China Unicom (Shanghai) [10433.67 km]: 170.885 ms
Testing download speed................................................................................
Download: 296.84 Mbit/s
Testing upload speed................................................................................................
Upload: 106.75 Mbit/s
Share results: http://www.speedtest.net/result/6590721765.png

美国的服务器在上海节点还是蛮快的…

 

一键命令(小惊喜)

如果上面的全部看不懂…那就只好用最简单的命令了…

上面的全部不用安装…直接用下面的命令就行了…

wget -N --no-check-certificate https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py && python speedtest.py --share

 

附加信息

speedtest官网:www.speedtest.net

speedtest中文官网:www.speedtest.cn

speedtest-cli GITHUB:github.com/sivel/speedtest-cli

 

 

发表评论

发表评论

*

没人评论,好尴尬~