在进行生产环境网络状态检测、测试网络质量、网络传输能力极限的时候就经常会用到下面的 Linux 工具,每一种工具都有其侧重点,我们可以根据具体的关注点来有选择性的使用这些工具。
一、nethogs(进程级别)
NetHogs is a simple open-source utility that runs in the terminal. Instead of breaking the traffic down per protocol or per subnet, it groups bandwith by process. It is very helpful for finding the PID of a hanging program or just for seeing what is eating your bandwidth. It relies mostly on /proc, so most features are Linux-only.
NetHogs 是一个在终端中运行的简单开源实用程序。它不是按协议或每个子网分解流量,而是按进程对 bandwith 进行分组。这对于查找挂起程序的 PID 或仅查看正在消耗带宽的内容非常有帮助。它主要依赖于/proc,因此大多数功能仅适用于Linux。
To run it, simply use:
要运行它,只需使用:
sudo nethogs
Conveniently, you can specify devices after the command (such as sudo nethogs eth0). You also have additional parameters, such as choosing a delay for the refresh rate (-d), version info (-V), tracemode (-t) and a few others which you can check out in the man pages (