温馨提示×

ubuntu ifconfig如何查看网络带宽

小樊
43
2025-11-09 11:46:58
栏目: 智能运维

在 Ubuntu 系统中,ifconfig 命令主要用于查看和配置网络接口的参数,但它并不直接显示网络带宽的使用情况。如果你想查看网络带宽的使用情况,可以使用以下几种方法:

  1. 使用 ip 命令:

    • 查看网络接口的状态:
      ip addr show
      
    • 查看网络接口的统计信息(包括接收和发送的字节数):
      ip -s link
      
  2. 使用 nethogs 工具:

    • nethogs 是一个实时监控网络带宽使用情况的工具,可以按进程查看带宽使用。
    • 首先需要安装 nethogs
      sudo apt install nethogs
      
    • 然后运行它:
      sudo nethogs eth0  # 将 eth0 替换为你的网络接口名称
      
  3. 使用 iftop 工具:

    • iftop 可以实时显示网络带宽的使用情况。
    • 安装 iftop
      sudo apt install iftop
      
    • 运行 iftop
      sudo iftop -i eth0  # 将 eth0 替换为你的网络接口名称
      
  4. 使用 vnstat 工具:

    • vnstat 是一个网络流量监控工具,可以记录并报告网络接口的流量统计信息。
    • 安装 vnstat
      sudo apt install vnstat
      
    • 启动 vnstat 服务:
      sudo systemctl start vnstat
      
    • 查看网络接口的流量统计:
      vnstat -i eth0  # 将 eth0 替换为你的网络接口名称
      

这些工具可以帮助你监控和分析网络带宽的使用情况。

0