AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1430230
Accepted
Cardinal System
Cardinal System
Asked: 2019-04-27 16:23:04 +0800 CST2019-04-27 16:23:04 +0800 CST 2019-04-27 16:23:04 +0800 CST

从命令行获取网络利用率

  • 772

在 Windows 任务管理器中,有一个方便的网络选项卡,它显示连接的网络适配器的链接速度和网络利用率(以可用带宽的百分比表示):

任务管理器截图

有没有办法通过命令行获取这些信息?

windows command-line
  • 3 3 个回答
  • 11304 Views

3 个回答

  • Voted
  1. David
    2019-04-30T13:47:47+08:002019-04-30T13:47:47+08:00

    这可以在不通过 PowerShell 安装任何东西的情况下完成。

    您可以使用以下命令查看每个适配器的总速度和名称:

    Get-NetAdapter
    

    然后您可以获取名称并将其放入唯一 ID 并查看传入流量的数量:

    Get-Counter "\Network Interface(<unique id>)\Bytes Received/sec"
    

    如果您想要传出或总流量,请使用:

    Get-Counter "\Network Interface(<unique id>)\Bytes Sent/sec"
    Get-Counter "\Network Interface(<unique id>)\Bytes Total/sec"
    

    您还可以通过添加以下内容来衡量一段时间内的使用情况:

    -SampleInterval 3 -MaxSamples 5
    

    有关详细信息,请参阅帮助页面。

    • 4
  2. Best Answer
    sancho.s ReinstateMonicaCellio
    2019-05-06T04:27:23+08:002019-05-06T04:27:23+08:00

    有很多(大量?)命令行选项可以提供有关网络使用情况的信息。 这涉及到这个问题,那里的答案与目前的 OP 有很大的重叠。正如 OP 中所要求的,其中许多不提供带宽使用百分比。

    1. 上面给出了Wireshark的选项。

    2. typeperf(Windows native) 也很相关,有几个选项。 typeperf -q "Network Interface"列出所有对象。然后,使用typeperf "\Network Interface(*)\...以下选项:

      \Network Interface(*)\Current Bandwidth
      \Network Interface(*)\Bytes Total/sec
      \Network Interface(*)\Bytes Received/sec
      \Network Interface(*)\Bytes Sent/sec
      \Network Interface(*)\Packets/sec
      \Network Interface(*)\Packets Received/sec
      \Network Interface(*)\Packets Sent/sec
      

      注意公式是((Total Bytes/Sec * 8)/current bandwidth) * 100。其他有用的选项:

      \Network Interface(*)\Packets Received Unicast/sec
      \Network Interface(*)\Packets Received Non-Unicast/sec
      \Network Interface(*)\Packets Received Discarded
      \Network Interface(*)\Packets Received Errors
      \Network Interface(*)\Packets Received Unknown
      \Network Interface(*)\Packets Sent Unicast/sec
      \Network Interface(*)\Packets Sent Non-Unicast/sec
      \Network Interface(*)\Packets Outbound Discarded
      \Network Interface(*)\Packets Outbound Errors
      \Network Interface(*)\Output Queue Length
      \Network Interface(*)\Offloaded Connections
      

      可以使用flag -sc <samples>(指定要收集的样本数量。默认是收集数据直到按下CTRL+C),参见官方文档。
      标志-o <filename>(指定输出文件或 SQL 数据库的路径。默认为 STDOUT(写入命令窗口)。)也可能有用。

    3. 此处提供了一个有趣的脚本,可以对其进行自定义以提供各种信息并对其进行格式化。

    • 3
  3. Reddy Lutonadio
    2019-04-30T11:34:10+08:002019-04-30T11:34:10+08:00

    安装Wireshark并用于tshark收集统计信息:

    tshark -z <statistics>
    

    您可以使用netstat:

    netstat -a -n
    

    或者typeperf:

    typeperf "Network Interface(*)\Current Bandwidth"
    typeperf "Network Interface(*)\Bytes Total/sec"
    
    • 1

相关问题

  • Python 的“pass”参数的批处理等价物是什么?

  • 禁用后无法启用 Microsoft Print to PDF

  • 在 Windows 上与 Docker 守护进程通信

  • 资源管理器侧面板中的桌面外壳快捷方式

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    Windows 10 服务称为 AarSvc_70f961。它是什么,我该如何禁用它?

    • 2 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Marko Smith

    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1056)

    • 4 个回答
  • Marko Smith

    我如何知道 Windows 安装在哪个驱动器上?

    • 6 个回答
  • Martin Hope
    Albin 支持结束后如何激活 WindowsXP? 2019-11-18 03:50:17 +0800 CST
  • Martin Hope
    fixer1234 “HTTPS Everywhere”仍然相关吗? 2019-10-27 18:06:25 +0800 CST
  • Martin Hope
    Kagaratsch Windows 10 删除大量小文件的速度非常慢。有什么办法可以加快速度吗? 2019-09-23 06:05:43 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    Inter Sys Ctrl+C 和 Ctrl+V 是如何工作的? 2019-05-15 02:51:21 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve