Speedtest CLI使用帮助

来自speedtest.netSpeedtest Cli, 不是speedtest.cn命令行测速工具

1
2
3
4
5
6
7
8
speedtest 
    [-aAbBfhiIpPsv] [--ca-certificate=path] 
    [--format=[=format-type]] [--help] 
    [--interface=interface] [--ip=ip_address] 
    [--output-header] [--precision=num_decimal_places] 
    [--progress=yes|no] [--selection-details] 
    [--server-id=id] [--servers] 
    [--unit=[=unit-of-measure]] [--version]
-h, –help打印使用信息
-v记录详细程度, 为更高的详细程度指定多次 (例如-vvv)
-V, –version打印版本号
-L, –servers列出最近的服务器
–selection-details显示服务器选择详细信息
-s id, –server-id=id使用服务器id从服务器列表中指定服务器
-o hostname, –host=hostname从服务器列表中使用其主机名指定服务器
-f format_type,–format=format_type输出格式 (默认值=human-readable)
注意
Machine readable (csv、tsv、json、json、json pretty) 使用字节作为最大精度的测量单位。

format_type的值如下:

formattype
human-readable人类可读输出
csv逗号分隔值
tsv制表符分隔值
jsonjavascript对象表示法 (compact)
jsonljavascript对象表示法 (lines)
json-prettyjavascript对象表示法 (pretty)
  • --output-header显示CSV和TSV格式的输出标题

  • -u* unit_of_measure, --unit* unit_of_measure

    用于显示速度的输出装置 (注: 这仅适用于对于human-readable输出格式, 默认单位为Mbps)

    单位解释
    bpsbits 每秒 (十进制前缀)
    kbpskilobits 每秒 (十进制前缀)
    Mbpsmegabits 每秒 (十进制前缀)
    Gbpsgigabits 每秒 (十进制前缀)
    kibpskilobits 每秒 (二进制前缀)
    Mibpsmegabits 每秒 (二进制前缀)
    Gibpsgigabits 每秒 (二进制前缀)
    B/sbytes 每秒
    kB/skilobytes 每秒
    MB/smegabytes 每秒
    GiB/sgigabytes 每秒
    auto-binary-bytes自动二进制字节
    auto-decimal-bytes自动十进制字节
    auto-binary-bits自动二进制位
    auto-decimal-bits自动十进制位
  • -a

    [-u auto-decimal-bits] 的快捷方式

  • -A

    [-u auto-decimal-bytes] 的快捷方式

  • -b

    [-u auto-binary-bits] 的快捷方式

  • -B

    [-u auto-binary-bytes] 的快捷方式

  • -P decimal_places --precision=decimal_places

    要使用的小数位数 (默认 = 2, 有效 = 0~8)

  • -p yes | no --progress=yes | no

    启用或禁用进度条 (默认 = yes, 互动时)

  • -I interface --interface=interface

    连接到服务器时尝试绑定到指定的接口

  • -i ip_address --ip=ip_address

    连接到服务器时尝试绑定到指定的IP地址

  • --ca-certificate=path

    CA证书捆绑包的路径, 请参阅下面的注释。

成功执行后, 应用程序将退出, 退出代码为0。结果将包括延迟、抖动、下载、上载、数据包丢失 (如果可用) 和结果URL。

延迟和抖动将以毫秒表示。下载和上传单元将取决于输出格式以及是否指定了单位。

human-readable格式默认为Mbps和任何机器可读格式 (csv、tsv、json、json、json pretty) 使用字节作为最大精度的度量单位。

数据包丢失用百分比表示, 当数据包丢失在执行的网络环境中不可用时, 不可用

结果URL可用于共享您的结果, 将 .png附加到结果URL将创建一个可共享的结果图像。

human-readable 结果示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$ speedtest
    Speedtest by Ookla

     Server: Speedtest.net - New York, NY (id = 10390)
        ISP: Comcast Cable
    Latency:    57.81 ms   (3.65 ms jitter)
   Download:    76.82 Mbps (data used: 80.9 MB)
     Upload:    37.58 Mbps (data used: 65.3 MB)
Packet Loss:     0.0%
 Result URL: https://www.speedtest.net/result/c/8ae1200c-e639-45e5-8b55-41421a079250

默认情况下, 网络请求将超时设置为10秒。唯一的例外是是延迟测试, 它将超时设置为15秒。

一旦出现致命错误, 应用程序将以非零退出代码退出。 **初始化致命错误示例: **

Configuration - Couldn't connect to server (Network is unreachable)

Configuration - Could not retrieve or read configuration (ConfigurationError)

**阶段执行致命错误示例: **

[error] Error: [1] Latency test failed for HTTP

[error] Error: [36] Cannot open socket: Operation now in progress

[error] Failed to resolve host name. Cancelling test suite

[error] Host resolve failed: Exec format error

[error] Cannot open socket: No route to host

[error] Server Selection - Failed to find a working test server. (No Servers)

默认情况下, 会检查linux计算机上CA证书捆绑包的以下路径:

1
2
3
4
5
/etc/ssl/certs/ca-certificates.crt
/etc/pki/tls/certs/ca-bundle.crt
/usr/share/ssl/certs/ca-bundle.crt
/usr/local/share/certs/ca-root-nss.crt
/etc/ssl/cert.pem

如果测试中的设备没有以上提到的文件之一, 那么curl项目提供的规范和最新的CA证书包可以手动完成下载到特定位置。可根据以下示例将此特定位置作为参数提供:

1
2
wget https://curl.haxx.se/ca/cacert.pem
./ookla --ca-certificate=./cacert.pem