Linux Network Bandwidth Monitoring: Track TCP Connections

Quick Linux Tip #101:

Question: A single TCP connection seems slow. Can I measure its real throughput?

Try: sudo iftop -i eth0 -nNP -f 'port 443'

Info: iftop acts as top for network bandwidth, tracking individual connections and displaying 2s/10s/40s moving averages to pinpoint bandwidth hogs.

Examples:

  • $ sudo iftop -i eth0  # Launch interactive mode without filters
  • $ sudo iftop -i eth0 -t -s 30  # Output text mode summary for 30 seconds
  • $ sudo nload eth0  # View interface-wide bandwidth graphs

Note: Install via sudo apt install iftop. Interactive controls: press s to toggle source ports, d for destination ports, and t to cycle through traffic display modes.




LinuxTeck.com
linuxteck:~$ sudo iftop -i eth0 -nNP -f 'port 443'
          12.5Kb             25.0Kb             37.5Kb             50.0Kb             62.5Kb
       ──────────────────────────────────────────────────────────────────────────────
192.168.1.50:54321 => 203.0.113.45:443     1.23Mb  2.34Mb  3.45Mb
                         <=                     234Kb   456Kb   678Kb
192.168.1.50:54322 => 198.51.100.22:443     567Kb   789Kb   890Kb
                         <=                      45Kb    89Kb   123Kb
       ──────────────────────────────────────────────────────────────────────────────
TX: cum: 234MB  peak: 5.67Mb  rates: 1.79Mb  3.12Mb  4.33Mb
RX: cum: 45.6MB peak: 1.23Mb  rates: 279Kb  545Kb  801Kb
TOTAL: cum: 280MB peak: 6.89Mb rates: 2.07Mb  3.67Mb  5.14Mb
linuxteck:~$

PREVIOUS ARTICLE Quick Linux Tip #100: Linux Shutdown Protection: Prevent Accidental Server Shutdowns NEXT ARTICLE Quick Linux Tip #102: Linux DNS Troubleshooting: Trace DNS Resolution in 3 Steps
About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.