全球主机交流论坛备用站

 找回密码
 立即注册

QQ登录

只需一步,快速开始

全球云38元起免备案V2EX搬瓦工VPS
SEO查询超级PING网站测速
Virmach特价鸡乌云漏洞吾爱破解
查看: 16|回复: 0

Linux 测速(使用SpeedTest-cli)

[复制链接]

3

主题

3

帖子

13

积分

新手上路

Rank: 1

积分
13
发表于 2024-5-4 19:57:49 | 显示全部楼层 |阅读模式
20230417
本帖最后由 oldbaby 于 2024-5-4 20:34 编辑

脚本介绍
speedtest 是一款使用 python 语言编写的轻量级的 linux 命令行测速工具,在 python2 以及 python3 的环境下都可以运行,基于 speedtest.net 基础框架来测量网络的上下行数据,安装也很简单,只要下载对应的 python 文件执行即可。

测速方法

1、先下载脚本(wget 下载或者下载好上传到服务器上)
wget https://raw.githubusercontent.co ... master/speedtest.py

2、为脚本授权
chmod a+rx speedtest.py
chown root:root speedtest.py

3、移至本机运行目录
mv speedtest.py /usr/local/bin/speedtest

4、执行测速
speedtest-cli


上述步骤进行完发现出现报错      
[root@~]# speedtest-cli
/usr/bin/env: ‘python’: No such file or directory    注:发现是因为没有python环境导致的

[root@~]# python --version
-bash: python: command not found                    注:确定了  没有安装python

好 现在去安装python
[root@~]# yum install python3
省略安装内容ing
Complete!

安装完成。好现在我们来看一下
[root@~]# python3 --version
Python 3.6.8                                                    注:ok安装完成     后续步骤即可按照


[root@ecs-test ~]# speedtest-cli
/usr/bin/env: ‘python’: No such file or directory
[root@ecs-test ~]# python3 --version
Python 3.6.8
[root@ecs-test ~]# whereis python3
python3: /usr/bin/python3.6 /usr/bin/python3 /usr/bin/python3.6m /usr/lib/python3.6 /usr/lib64/python3.6 /usr/local/lib/python3.6 /usr/include/python3.6m /usr/share/man/man1/python3.1.gz
[root@ecs-test ~]# sudo ln -s /usr/bin/python3 /usr/bin/python           注:这里路径python3不能打错  不然又会报错的
[root@ecs-test ~]# speedtest-cli
Retrieving speedtest.net configuration...
Testing from XXX Cloud (xxx.xx.xx.x)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by HK Broadband Network (XXX XXX) [0.87 km]: 3.969 ms
Testing download speed................................................................................
Download: 596.37 Mbit/s
Testing upload speed......................................................................................................
Upload: 8.80 Mbit/s


感谢csdn博客的catoop的部分帖子指导

原文出处


MJJ,你的签名掉了~~~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

展开

QQ|Archiver|手机版|小黑屋|全球主机交流论坛备用站

GMT+8, 2024-5-19 04:53 , Processed in 0.041690 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表