linux下 网速查询 网卡信息查询

本文介绍了在Linux环境下如何查询网速及网卡详细信息。通过安装speedtest工具进行网速测试,结果显示良好。同时,利用ethtool命令获取了ens33网卡的配置,包括速度1000Mb/s、全双工状态以及连接检测为正常。
摘要由CSDN通过智能技术生成

网速查询

  1. 安装speedtest
root@ubuntu:~# apt install speedtest-cli
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpython-stdlib python python-minimal python-pkg-resources python2.7 python2.7-minimal
Suggested packages:
  python-doc python-tk python-setuptools python2.7-doc binfmt-support
The following NEW packages will be installed:
  libpython-stdlib python python-minimal python-pkg-resources python2.7 python2.7-minimal
  speedtest-cli
0 upgraded, 7 newly installed, 0 to remove and 148 not upgraded.
Need to get 1,868 kB of archives.
After this operation, 5,648 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 python2.7-minimal amd64 2.7.17-1~18.04ubuntu1 [1,294 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 python-minimal amd64 2.7.15~rc1-1 [28.1 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu bionic-updates/main amd64 python2.7 amd64 2.7.17-1~18.04ubuntu1 [248 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 libpython-stdlib amd64 2.7.15~rc1-1 [7,620 B]
Get:5 http://us.archive.ubuntu.com/ubuntu bionic/
Linux环境下,获取eth0网卡的实时流量速度(通常称为带宽使用情况或吞吐量)并不直接提供一个命令行工具,但是你可以使用一些第三方工具或者通过内核提供的接口来获取。这里介绍几种常见的方法: **使用ifstat或iftop** 1. **iftop**: 这是一个交互式的带宽监控工具,可以在终端中显示网络接口的实时流量数据。安装后,运行`iftop -i eth0`可以看到eth0网卡的速度信息。 ```sh sudo apt-get install iftop # 对于基于Debian的系统 sudo yum install iftop # 对于基于RPM的系统 iftop -i eth0 ``` 2. **ifstat** (仅适用于某些发行版):这是一个简洁的带宽监视工具,可以用`ifstat -a | grep eth0`查看eth0接口的统计信息。 ```sh ifstat -a | grep eth0 ``` **使用ethtool** ethtool是一个用于查询、设置和监控网卡性能的工具,虽然它本身不直接显示速率,但你可以借助它获得统计数据然后计算平均速率。 ```sh ethtool -S eth0 ``` 然后分析输出中的RX/TX bytes等信息。 **内核命令行参数** 还可以使用`/proc/net/dev`目录下的文件,这是内核提供的接口,需要稍微解析一下: ```sh cat /proc/net/dev | grep eth0 | awk '{print $9+$10 " MBit/s"}' ``` 请注意,这些方法提供的都是估算值,并非严格的实时流速,实际带宽可能会因为网络拥塞、应用负载等因素有所不同。如果你需要非常精确的数据,可能需要部署专门的网络监控工具或者服务。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值