Is it possible to measure the used bandwidth per udp/tcp port on linux?

I am wondering if there is a way to measure bandwidth by a tcp/udp port under Linux?

Means I search for a way to be able to tell, tcp/53 needs now 1MBit/s, tcp/80 needs now 4.5MBit/s. iperf is able to tell me this details, but my issue is I need it in shell/bash to extract the data for later use.


i would recommend darkstat, a description on how to is available here


Just for completeness, the best and easiest way to monitor bandwidth per port or bunch of ports under Linux, is to use tc to setup QoS.

You can use FireQoS - a high level tool for configuring QoS - and netdata for monitoring it in real-time.

Check this for more information: https://github.com/firehol/netdata/wiki/You-should-install-QoS-on-all-your-servers