Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the nethogs command. As the name implies, nethogs will display information on how much processes using or “hogging” your network bandwidth. To use nethogs, you would run a command like this:
By default, you will be getting updates every second. The processes in network usage order – heaviest users first.
Nethogs works something like top and similar commands, but focusses just on network bandwidth. This can help you identify and, if necessary, kill any processes that might be causing problems.
If you want to see updates less frequently than once/second, you can specify your loop timing like this:
In this case, we get updates once every 5 seconds. The “d” stands for “delay for refresh rate”.
Notice that the output displays the process ID, user, process name, network interface and traffic in both directions. In this example, the process using the most bandwidth is transferring a group of large files.
Anytime you notice a serious slowdown on your network, the nethogs command might help you find the cause.
That’s your Linux tip for the nethogs command.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.