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.

2 Answers 2


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

  • Hello Corleone, thank you for darkstat, did not know about it before. I cannot find a option how to trace my specific ports to stdin or to a file for later parsing? Do you know how to handle it?
    – cilap
    Commented Oct 2, 2015 at 9:10
  • retrying: Corleone, can you help me on my query?
    – cilap
    Commented Oct 6, 2015 at 11:57
  • @cilap Nope!! Sry missed your comment, came to know the features of darkstat, and suggested post googling
    – Corleone
    Commented Oct 6, 2015 at 18:13

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

  • This looks very interesting. I already use tc a lot at home and at my VPS provider. It will be interesting to see what kind of rules they effectively generate.
    – Aaron
    Commented May 26, 2017 at 12:00
  • The link in this answer doesn't seem to lead to the intended content anymore. It looks like this content, or something similar, is now here: learn.netdata.cloud/docs/data-collection/…
    – Michael
    Commented Jun 25, 2023 at 9:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .