Ubuntu 監控網路使用情況
阿新 • • 發佈:2020-08-11
安裝網路監測工具
$ 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 inet6 addr: 2001:da8:d800:7306:ec4:7aff:fee6:4ab9/64 Scope:Global inet6 addr: fe80::ec4:7aff:fee6:4ab9/64 Scope:Link 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
鍵可退出。