linux下命令行上传下载测速

 

好吧,最近搞了个香港服务器,但是香港带宽限制比较严格,当然不能吃亏了,测速,必须测速。

今天主角出场speedtest-cli,它工作在Python 2.4-3.4

安装:

  1. pip / easy_install 
  2.  
  3. pip install speedtest-cli 
  4.  
  5. or 
  6.  
  7. easy_install speedtest-cli 
  8.  
  9. Github 
  10.  
  11. pip install git+https://github.com/sivel/speedtest-cli.git 
  12.  
  13. or 
  14.  
  15. git clone https://github.com/sivel/speedtest-cli.git 
  16. python speedtest-cli/setup.py install 
  17.  
  18. Just download (Like the way it used to be) 
  19.  
  20. wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py 
  21. chmod +x speedtest-cli 
  22.  
  23. or 
  24.  
  25. curl -Lo speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest_cli.py 
  26. chmod +x speedtest-cli 

功能和使用:

  1. $ speedtest-cli -h 
  2. usage: speedtest-cli [-h] [--bytes] [--share] [--simple] [--list] 
  3.                      [--server SERVER] [--mini MINI] [--source SOURCE] 
  4.                      [--timeout TIMEOUT] [--version] 
  5.  
  6. Command line interface for testing internet bandwidth using speedtest.net. 
  7. -------------------------------------------------------------------------- 
  8. https://github.com/sivel/speedtest-cli 
  9.  
  10. optional arguments: 
  11.   -h, --help         show this help message and exit 
  12.   --bytes            Display values in bytes instead of bits. Does not affect 
  13.                      the image generated by --share 
  14.   --share            Generate and provide a URL to the speedtest.net share 
  15.                      results image 
  16.   --simple           Suppress verbose output, only show basic information 
  17.   --list             Display a list of speedtest.net servers sorted by 
  18.                      distance 
  19.   --server SERVER    Specify a server ID to test against 
  20.   --mini MINI        URL of the Speedtest Mini server 
  21.   --source SOURCE    Source IP address to bind to 
  22.   --timeout TIMEOUT  HTTP timeout in seconds. Default 10 
  23.   --version          Show the version number and exit 

简单测速,奶牛是在ubuntu下进行的测试:

  1. apt-get install python-pip 
  2. pip install speedtest-cli 

安装完成后执行:

  1. speedtest 

测试结果如下:

  1. root@gameserver1:~# speedtest  
  2. Retrieving speedtest.net configuration...  
  3. Retrieving speedtest.net server list...  
  4. Testing from Shanghai Anchnet Network Technology (XXX.XXX.XXX.XXX)...  
  5. Selecting best server based on latency...  
  6. Hosted by Shanghai Branch, China Unicom (Shanghai) [19.64 km]: 29.249 ms  
  7. Testing download speed........................................  
  8. Download: 18.84 Mbit/s  
  9. Testing upload speed..................................................  
  10. Upload: 1.51 Mbit/s  

 

奶牛 | 2015年07月27日