主机、服务器测评
服务器促销信息及建站资源分享

Speedtest-CLI Linux系统带宽测速教程(Speedtest-CLI最新一键测速脚本)

Speedtest-CLI是Speedtest.net旗下一个开源的一键测速脚本,可以一键测试Linux系统服务器就近节点的上传及下载速度,也可以一键测试Linux系统服务器到指定节点的速度,还可以一键获取Linux系统服务器就近节点的Speedtest测速节点。关于Speedtest-CLI相对以前是可以获取全部节点列表的,目前最多只能获取就近10个左右的节点!由于Speedtest-CLI一键测速脚本可能在后面需要用得到,主机玖玖这里记录一下,方便以后查找。

如果需要较为全面的Speedtest测速脚本,可以查看下面文章:

Speedtest-CLI Linux系统带宽测速教程(Speedtest-CLI最新一键测速脚本)插图

 

一、Speedtest-CLI一键测速脚本安装

1、如果你的系统之前安装过Speedtest-CLI旧版本,请先执行下面命令卸载,然后在安装。

# Ubuntu/Debian系统卸载请执行下面命令 www.zhuji999.com:
sudo rm /etc/apt/sources.list.d/speedtest.list
sudo apt-get update
sudo apt-get remove speedtest
sudo apt-get remove speedtest-cli
 
# CentOS/Fedora/Redhat系统卸载请执行下面命令www.zhuji999.com:
sudo rm /etc/yum.repos.d/bintray-ookla-rhel.repo
sudo yum remove speedtest
rpm -qa | grep speedtest | xargs -I {} sudo yum -y remove {}

2、Ubuntu/Debian系统安装命令:

apt install -y curl
curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
sudo apt-get install speedtest

3、CentOS/Fedora/Redhat系统安装命令:

yum install -y curl
curl -s https://install.speedtest.net/app/cli/install.rpm.sh | sudo bash
sudo yum install speedtest

 

二、Speedtest-CLI一键测速命令

用上面的脚本安装好Speedtest-CLI测速程序后,可以选择使用下面命令来进行测速。

1、直接测速服务器就近节点速度。属于“speedtest”执行即可。

speedtest

测速结果如下:

[root@C20220807179539 ~]# speedtest

   Speedtest by Ookla

      Server: wuhan hello 5G - Wuhan (id: 29353)
         ISP: CloudITIDC Global
Idle Latency:    33.02 ms   (jitter: 0.42ms, low: 32.36ms, high: 33.95ms)
    Download:     1.83 Mbps (data used: 2.9 MB)                                                   
                 28.54 ms   (jitter: 20.13ms, low: 26.68ms, high: 824.93ms)
      Upload:     9.57 Mbps (data used: 4.3 MB)                                                   
                 30.50 ms   (jitter: 2.13ms, low: 25.04ms, high: 38.24ms)
 Packet Loss: Not available.
  Result URL: https://www.speedtest.net/result/c/e2c8e53d-bdc3-44bd-ab6b-a98f90c903fa

2、查看服务器最新测速节点列表。

speedtest -L

测试结果如下:

[root@C20220807179539 ~]# speedtest -L
Closest servers:

    ID  Name                           Location             Country
==============================================================================
 41910  China Mobile Henan 5G          Zhengzhou            China
 36646  China Unicom HeNan 5G          Zhengzhou            China
 44176  河南移动5G                 Zhengzhou            China
 17145  China Telecom AnHui 5G         Hefei                China
 26404  安徽移动5G                 Hefei                China
 29353  wuhan hello 5G                 Wuhan                China
 23844  China Telecom Wuhan Branch     Wuhan                China
 26352  China Telecom JiangSu 5G       Nanjing              China
 35722  China Telecom TianJin          TianJin              China
  5317  江苏电信5G                 Yangzhou             China
[root@C20220807179539 ~]#

除了上述可以通过服务器使用“speedtest -L”命令来查看服务器最近测速节点玩,我们目前还可以通过访问下面两个网站地址来查找距离我们本地或者访问网站的服务器较近的SpeedTest测速节点。

3、测试服务器到指定节点的速度。注意下面代码当中的“99999”请用节点ID代替。如测试“5317 江苏电信5G Yangzhou China”这个节点,我们用“speedtest -s 5317”来测试结果。

speedtest -s 99999

“speedtest -s 5317”测速结果。

[root@C20220807179539 ~]# speedtest -s 5317

   Speedtest by Ookla

      Server: 江苏电信5G - Yangzhou (id: 5317)
         ISP: CloudITIDC Global
Idle Latency:    42.84 ms   (jitter: 1.59ms, low: 40.69ms, high: 44.10ms)
    Download:     1.79 Mbps (data used: 3.2 MB)                                                   
                 40.40 ms   (jitter: 17.03ms, low: 39.41ms, high: 356.90ms)
      Upload:     9.57 Mbps (data used: 4.3 MB)                                                   
                 46.24 ms   (jitter: 5.39ms, low: 41.35ms, high: 148.12ms)
 Packet Loss:     9.3%
  Result URL: https://www.speedtest.net/result/c/f4097007-16f1-4b36-acba-1d2e21df28cb
[root@C20220807179539 ~]#

4、查看帮助,可以直接输入下面命令,会列举出Speedtest-CLI相关的帮助信息。

speedtest -h

帮助信息如下:

Version: speedtest 1.2.0.84

Usage: speedtest []
  -h, --help                        Print usage information
  -V, --version                     Print version number
  -L, --servers                     List nearest servers
  -s, --server-id=#                 Specify a server from the server list using its id
  -I, --interface=ARG               Attempt to bind to the specified interface when connecting to servers
  -i, --ip=ARG                      Attempt to bind to the specified IP address when connecting to servers
  -o, --host=ARG                    Specify a server, from the server list, using its host's fully qualified domain name
  -p, --progress=yes|no             Enable or disable progress bar (Note: only available for 'human-readable'
                                    or 'json' and defaults to yes when interactive)
  -P, --precision=#                 Number of decimals to use (0-8, default=2)
  -f, --format=ARG                  Output format (see below for valid formats)
      --progress-update-interval=#  Progress update interval (100-1000 milliseconds)
  -u, --unit[=ARG]                  Output unit for displaying speeds (Note: this is only applicable
                                    for ‘human-readable’ output format and the default unit is Mbps)
  -a                                Shortcut for [-u auto-decimal-bits]
  -A                                Shortcut for [-u auto-decimal-bytes]
  -b                                Shortcut for [-u auto-binary-bits]
  -B                                Shortcut for [-u auto-binary-bytes]
      --selection-details           Show server selection details
      --ca-certificate=ARG          CA Certificate bundle path
  -v                                Logging verbosity. Specify multiple times for higher verbosity
      --output-header               Show output header for CSV and TSV formats

 Valid output formats: human-readable (default), csv, tsv, json, jsonl, json-pretty

 Machine readable formats (csv, tsv, json, jsonl, json-pretty) use bytes as the unit of measure with max precision

 Valid units for [-u] flag: 
   Decimal prefix, bits per second:  bps, kbps, Mbps, Gbps
   Decimal prefix, bytes per second: B/s, kB/s, MB/s, GB/s
   Binary prefix, bits per second:   kibps, Mibps, Gibps
   Binary prefix, bytes per second:  kiB/s, MiB/s, GiB/s
   Auto-scaled prefix: auto-binary-bits, auto-binary-bytes, auto-decimal-bits, auto-decimal-bytes

 

赞(1)
聲明:
1、本博客不從事任何主機及服務器租賃業務,不參與任何交易,也絕非中介。博客內容僅記錄博主個人感興趣的服務器測評結果及一些服務器相關的優惠活動,信息均摘自網絡或來自服務商主動提供;所以對本博客提及的內容不作直接、間接、法定、約定的保證,博客內容也不具備任何參考價值及引導作用,訪問者需自行甄別。

2、訪問本博客請務必遵守有關互聯網的相關法律、規定與規則;不能利用本博客所提及的內容從事任何違法、違規操作;否則造成的一切後果由訪問者自行承擔。

3、未成年人及不能獨立承擔法律責任的個人及群體請勿訪問本博客。

4、一旦您訪問本博客,即表示您已經知曉並接受了以上聲明通告。

文章名稱:《Speedtest-CLI Linux系统带宽测速教程(Speedtest-CLI最新一键测速脚本)》
文章鏈接:https://www.zhuji999.com/13647.html