Loading

Ubuntu 监控网络使用情况

安装网络监测工具

$ sudo apt install nethogs

然后在终端执行

$ sudo nethogs

## 可能会报以下错误
# ioctl failed while establishing local IP for selected device veth20cf3fc. You may specify the device on the command line.

若报错需指定设备,则指定具体的网口,可通过 ifconfig 查看设备名称

$ ifconfig

eno1      Link encap:Ethernet  HWaddr 0c:c4:7a:e6:4a:b8
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Memory:fb120000-fb13ffff

eno2      Link encap:Ethernet  HWaddr 0c:c4:7a:e6:4a:b9
          inet addr:192.168.6.31  Bcast:192.168.6.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:293845736 errors:0 dropped:2234 overruns:1186 frame:0
          TX packets:755625613 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:237647351984 (237.6 GB)  TX bytes:1064607047634 (1.0 TB)
          Memory:fb100000-fb11ffff

指定查看设备即可

$ sudo nethogs eno2

q 键可退出。

posted @ 2020-08-11 16:16  xieqk  阅读(996)  评论(0编辑  收藏  举报