Ubuntu 使用 speedtest_cli检测实时带宽速度
安装 speedtest_cli
首先使用vim进入系统软件源
root@kinpui:/home/kin# vim /etc/apt/sources.list
在文件最后加上以下一个软件源
deb http://archive.getdeb.net/ubuntu trusty-getdeb apps
增加仓库GPG钥匙,打开终端窗口,然后输入:
wget -q -O- http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add -
使用下面的命令安装speedtest_cli包了:
root@kinpui:/home/kin$ sudo apt-get update
root@kinpui:/home/kin$ sudo apt-get install python-speedtest-cli
来自 http://os.51cto.com/art/201409/450960.htm
你可以不带任何选项地运行speedtest_cli.py,然后你会在终端获得关于你带宽速度的报告,这就是我那糟糕的意大利Adsl输出:
1 $ ./speedtest_cli.py
2 Retrieving speedtest.net configuration...
3 Retrieving speedtest.net server list...
4 Testing from Telecom Italia (87.13.73.66)...
5 Selecting best server based on latency...
6 Hosted by LepidaSpA (Bologna) [12.20 km]: 104.347 ms
7 Testing download speed........................................
8 Download: 6.35 Mbits/s
9 Testing upload speed...............................................
10 Upload: 0.34 Mbits/s
这就是基本用法,这足以让你知道你因特网连接的好坏,但是可能你想要和朋友分享这条信息,那么,只需要-share选项就可以
11 ./speedtest_cli.py --share
12 Retrieving speedtest.net configuration...
13 Retrieving speedtest.net server list...
14 Testing from Telecom Italia (87.13.73.66)...
15 Selecting best server based on latency...
16 Hosted by LepidaSpA (Bologna) [12.20 km]: 93.778 ms
17 Testing download speed........................................
18 Download: 6.20 Mbits/s
19 Testing upload speed...............................................
20 Upload: 0.33 Mbits/s
21 Share results: http://www.speedtest.net/result/3700218352.png
这将会产生一个类似于下面的图像(但是我希望你图像里面的值更好):
22 ![](http://www.speedtest.net/result/3700218352.png)
另一个有趣的选项是-list,它会按照距离列出所有speedtest.net服务器,下面是我运行的结果:
23 Retrieving speedtest.net configuration...
24 Retrieving speedtest.net server list...
25 2872) LepidaSpA (Bologna, Italy) [12.20 km]
26 1561) MYNETWAY S.R.L. (Cesena, Italy) [80.97 km]
27 2710) ReteIVO by D.t.s. Srl (Florence, Italy) [90.90 km]
28 4826) Inteplanet Srl (Verona, Italy) [100.45 km]
29 3998) Wolnext srl (Verona, Italy) [100.45 km]
30 2957) Wifiweb s.r.l. (Altavilla Vicentina, Italy) [103.11 km]
31 3103) E4A s.r.l. (Vicenza, Italy) [107.17 km]
32 3804) Interplanet Srl (Vicenza, Italy) [107.17 km]
33 1014) NTRnet (Vicenza, Italy) [107.17 km]
34 3679) Hynet s r l (Vicenza, Italy) [107.17 km]
35 3745) Comeser Srl (Fidenza, Italy) [114.00 km]
36 5011) Welcomeitalia spa (Massarosa, Italy) [119.26 km]
37 2864) ReteIVO by D.t.s. Srl (Massa, Italy) [120.92 km]
38 2918) ReteIVO by D.t.s. Srl (Arezzo, Italy) [129.79 km]
39 ...
既然我知道了围绕在我周围的服务器的ID,我可以使用-server选项选择一个特定的服务器,所以,要想选择位于佛罗伦萨(ID 2710)的服务器,我使用下面的命令:
40 ./speedtest_cli.py --server 2710
41 Retrieving speedtest.net configuration...
42 Retrieving speedtest.net server list...
43 Testing from Telecom Italia (87.13.73.66)...
44 Hosted by ReteIVO by D.t.s. Srl (Florence) [90.90 km]: 106.505 ms
45 Testing download speed........................................
46 Download: 6.18 Mbits/s
47 Testing upload speed..............................................
48 Upload: 0.35 Mbits/s