像iftop / iptraf这样的已知工具显示每个接口和每个连接的networkingI / O。 有没有办法查看每个进程的networkingI / O统计信息?
nethogs看起来像它会做你想要的。
编辑:我需要安装ncurses-devel,libpcap和libpcap-devel来构build。
要查找与每个进程关联的连接,请使用lsof。 例如:
lsof | grep TCP
这将给你一个连接列表,如下所示:
bash 10887 luke 3u IPv4 44638801 0t0 TCP littleyerry.example.com:55212->barista.example.com:ldap (ESTABLISHED) bash 10913 luke 3u IPv4 44638905 0t0 TCP littleyerry.example.com:55216->barista.example.com:ldap (ESTABLISHED) ssh 10935 luke 3u IPv4 44639001 0t0 TCP littleyerry.example.com:55219->barista.example.com:ldap (ESTABLISHED) ssh 10935 luke 4u IPv4 44639008 0t0 TCP littleyerry.example.com:59459->launchpad.example.com:ssh (ESTABLISHED) bash 10938 luke 3u IPv4 44639107 0t0 TCP littleyerry.example.com:55221->barista.example.com:ldap (ESTABLISHED)
从那里,你应该能够使用你提到的工具(iftop,iptraf)单独了解每个连接。 您可以构build一个小脚本来汇总您正在查找的特定数据。