有时间我们会需要测试一下当前本机的下载速度和上行速度,但是不可,Linux并没有自带这种技能,那就只能借助外力get此技能啦!!!
这里我们利用的是Speedtest工具,下面先容该工具的两种测试网速的方法
- 通过浏览器测试网速
- 通过下载源码,在下令行中测试网速
一、通过Speedtest官网直接测试网络速度
- Speedtest的官方网址
网址: https://www.speedtest.net/
通过浏览器打开该网址,点击Go 即可开启网速测试之旅
2、测试效果如下:
二、通过下载源码,在下令行中测试网速
这里用到一个Python工具speedtest,speedtest是一个用Python编写的轻量级Linux下令行工具,现在支持几乎所有的python版本Python 2.4-3.7。它基于Speedtest.net的底子架构来丈量网络的上/下行速率。安装speedtest很简朴——只需要下载其Python脚本文件。
1、下载安装
Speedtest的github的下载地点:
https://github.com/sivel/speedtest-cli
Speedtest有多种安装方式,选一种你喜欢的方式去安装它吧!方法如下:
- pip install speedtest-cli
复制代码- easy_install speedtest-cli
复制代码- pip install git+https://github.com/sivel/speedtest-cli.git
复制代码
- 用git先下载,然后在用python执行安装程序安装
- git clone https://github.com/sivel/speedtest-cli.git
- python speedtest-cli/setup.py install
复制代码- wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
- chmod +x speedtest-cli
复制代码- curl -Lo speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
- chmod +x speedtest-cli
复制代码 2、Speedtest的参数利用:
- $ speedtest-cli -h
- usage: speedtest-cli [-h] [--no-download] [--no-upload] [--bytes] [--share]
- [--simple] [--csv] [--csv-delimiter CSV_DELIMITER]
- [--csv-header] [--json] [--list] [--server SERVER]
- [--exclude EXCLUDE] [--mini MINI] [--source SOURCE]
- [--timeout TIMEOUT] [--secure] [--no-pre-allocate]
- [--version]
- Command line interface for testing internet bandwidth using speedtest.net.
- -https://github.com/sivel/speedtest-cli
- optional arguments:
- -h, --help show this help message and exit
- --no-download Do not perform download test
- --no-upload Do not perform upload test
- --bytes Display values in bytes instead of bits. Does not
- affect the image generated by --share, nor output from
- --json or --csv
- --share Generate and provide a URL to the speedtest.net share
- results image, not displayed with --csv
- --simple Suppress verbose output, only show basic information
- --csv Suppress verbose output, only show basic information
- in CSV format. Speeds listed in bit/s and not affected
- by --bytes
- --csv-delimiter CSV_DELIMITER
- Single character delimiter to use in CSV output.
- Default ","
- --csv-header Print CSV headers
- --json Suppress verbose output, only show basic information
- in JSON format. Speeds listed in bit/s and not
- affected by --bytes
- --list Display a list of speedtest.net servers sorted by
- distance
- --server SERVER Specify a server ID to test against. Can be supplied
- multiple times
- --exclude EXCLUDE Exclude a server from selection. Can be supplied
- multiple times
- --mini MINI URL of the Speedtest Mini server
- --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
- --no-pre-allocate Do not pre allocate upload data. Pre allocation is
- enabled by default to improve upload performance. To
- support systems with insufficient memory, use this
- option to avoid a MemoryError
- --version Show the version number and exit
复制代码 Reference:
1、https://blog.csdn.net/catoop/article/details/50350623
2、https://linux.cn/article-9558-1.html
3、https://blog.csdn.net/wh211212/article/details/52735229
4、https://blog.csdn.net/h952520296/article/details/78458072
♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠ ⊕ ♠
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |