【Linux或者Mac下命令行speedtest测试网络速度】我这里如下安装:
git clone https://github.com/sivel/speedtest-cli.git
Python3 speedtest-cli/setup.py install【这个根据自己的版本来安装就可以了】
在speedtest-cli这个目录下可以如下操作:
python3 speedtest.py
Retrieving speedtest.net configuration...
Testing from China Telecom (1.84.212.150)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Xi'an branch,Chinaunicom (Xi'an) [19.75 km]: 18.86 ms
Testing download speed................................................................................
Download: 79.70 Mbit/s
Testing upload speed......................................................................................................
Upload: 21.90 Mbit/s
其实这个speedtest.py也就是脚本了
可以直接如下:
cp speedtest.py speedtest?speedtest-cli git:(master) ? chmod 755 speedtest-cli.1?speedtest-cli git:(master) ? chmod 755 speedtest?speedtest-cli git:(master) ? ./speedtestRetrieving speedtest.net configuration...Testing from China Telecom (1.84.212.150)...Retrieving speedtest.net server list...Selecting best server based on ping...Hosted by China Unicom Lanzhou Branch Co.Ltd (Lanzhou) [483.74 km]: 24.266 msTesting download speed................................................................................Download: 96.11 Mbit/sTesting upload speed................................................................................................Upload: 21.86 Mbit/s
其实默认下载之后的介绍很详细了
Versions--------speedtest-cli works with Python 2.4-3.7.. image:: https://img.shields.io/pypi/pyversions/speedtest-cli.svg:target: https://pypi.python.org/pypi/speedtest-cli/:alt: VersionsInstallation------------pip / easy_install~~~~~~~~~~~~~~~~~~~::pip install speedtest-clior::easy_install speedtest-cliGithub~~~~~~::pip install git+https://github.com/sivel/speedtest-cli.gitor::git clone https://github.com/sivel/speedtest-cli.gitcd speedtest-clipython setup.py installJust download (Like the way it used to be)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~::wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.pychmod +x speedtest-clior::curl -Lo speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.pychmod +x speedtest-cliUsage-----::$ speedtest-cli -husage: speedtest-cli [-h] [--no-download] [--no-upload] [--single] [--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-clioptional arguments:-h, --helpshow this help message and exit--no-downloadDo not perform download test--no-uploadDo not perform upload test--singleOnly use a single connection instead of multiple. Thissimulates a typical file transfer.--bytesDisplay values in bytes instead of bits. Does notaffect the image generated by --share, nor output from--json or --csv--shareGenerate and provide a URL to the speedtest.net shareresults image, not displayed with --csv--simpleSuppress verbose output, only show basic information--csvSuppress verbose output, only show basic informationin CSV format. Speeds listed in bit/s and not affectedby --bytes--csv-delimiter CSV_DELIMITERSingle character delimiter to use in CSV output.Default ","--csv-headerPrint CSV headers--jsonSuppress verbose output, only show basic informationin JSON format. Speeds listed in bit/s and not
文章插图
另外感兴趣的可以看下linux下的axel多进程下载,将本地带宽抛满很好的测试工具 。
推荐阅读
- 一个在 MAC 上 iOS/Flutter 开发的辅助工具
- 硬盘有必要分区吗?MacOS、Linux都不分区
- linux中ELF格式二进制程序
- 利用这个 USB ID 仓库识别更多 Linux 上的设备
- Linux内核虚拟内存管理之匿名映射缺页异常分析
- Mac 上安装 pyenv 使用多版本python开发项目
- 在Linux中使用Bashtop与Bpytop监管系统资源
- 存储卡|读取最快95MB/s:创见推出MacBook Pro定制存储卡
- Linux驱动-互斥锁用法,建议先保存
- Linux,VMware桥接配置Centos网络