这次要介绍的就是 Speedtest by Ookla 的 CLI 版本,有这方面需求的应该也都知道。这次我就主要介绍一下安装和使用的方法。
安装
既然是 CLI 的版本,那接下来的操作也就都用命令行来演示了。我会演示 Windows 和 Debian 系的 Linux 发行版的安装方法。
Windows

开始之前可以先 cd 到目标目录

使用任意方法下载 https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-win64.zip

curl
命令下载文件使用任意方法解压刚刚下载的压缩包

tar
解压文件保留 speedtest.exe 即可,其他的可以删掉

此时输入speedtest
就可以测速了

Debian 及其衍生发行版

使用sudo apt-get install curl
命令安装 curl

使用curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
命令执行脚本

使用sudo apt-get install speedtest
命令安装 Speedtest CLI

输入speedtest
就可以测速了(不要在意我的测试结果)

如果你使用的不是上述的操作系统或发行版可以前往 Speedtest by Ookla 的官网查看安装方法
参数
使用-h
或--help
参数可以看到 Speedtest CLI 支持的参数,分别是:-h
/--help
、-V
/--version
、-L
/--servers
、-s
/--server-id=#
、-I
/--interface=ARG
、-i
/--ip=ARG
、-p
/--progress=yes|no
、-P
/--precision=#
、-f
/--format=ARG
、--progress-update-interval=#
、-u
/--unit[=ARG]
、-a
、-A
、-b
、-B
、-v
、--output-header
-h/–help
使用-h
或--help
参数可以查看所有支持的参数

-h
参数查看帮助-V/–version
使用-V
或--version
参数可以查看版本信息

-V
参数查看版本信息-L/–servers
使用-L
或--servers
参数可以查看可用的测速服务器

-L
参数查看可用服务器-s/–server-id=#
使用-s
或--server-id=#
参数可指定测速服务器

-s
、--server-id=#
参数指定测速服务器为60794(GuangZhou-5G)并进行测速-I/–interface=ARG
使用-I
或--interface
参数可指定网络接口,网络接口可使用ifconfig
命令查看

ifconfig
命令查看网络接口,并使用-I
、--interface=ARG
参数指定网络接口-i/–ip=ARG
使用-i
或--ip=ARG
参数可以通过 IP 指定测速服务器

-o/–host=ARG
-o
和--host=ARG
参数与-i
和--ip=ARG
参数类似,可以通过域名来指定测速服务器

-o
和--host=ARG
参数指定测速服务器为 speedtest.hk.chinamobile.com-p/–progress=yes|no
使用-p
或--progress=yes|no
参数决定是否要显示进度条,默认为yes

-p yes
参数时,会出现一个进度条
--progress=no
参数时,没有进度条-P/–precision=#
使用-P
或--precision=#
参数可以设置测试结果要精确到小数点后第几位,最低为0,最高为8,默认为2

-f/–format=ARG
使用-f
或--format=ARG
参数可指定输出格式,支持:csv、tsv、json、jsonl、json-pretty

-f
和--format
参数将测试结果分别输出到demo.csv和demo.json
–progress-update-interval=#
--progress-update-interval=#
参数可指定进度条刷新的时间,最低100(毫秒),最高1000(毫秒)。由于图片无法直观的展现出区别,我就不配图了,具体效果请自测
-u/–unit[=ARG]
使用-u
或--unit[=ARG]
参数可设置输出的单位,支持的选项有:bps、kbps:Mbps、Gbps、B/s、kB/s、MB/s、GB/s、kibps、Mibps、Gibps、kiB/s、Mib/s、GiB/s,默认为Mbps

-u
参数将单位设置为bps
--unit[=ARG]
参数将单位设置为MiB/s-a、-A、-b、-B
功能与上一条类似,不过多赘述
–selection-details
--selection-details
参数可显示服务器的详细信息

–ca-certificate=ARG
CA 证书,不做演示
-v
没研究明白😣
–output-header
为 csv / tsv 文件添加一行表头,需配合-f
/--format
参数使用

--output-header
参数添加表头
大概率是2023年最后一篇文章了,祝大家新年快乐呀😉