How do determine how much bandwidth a process is using in Linux

11

4

On occasion I see my bandwidth usage using gnome-system-monitor going up to 300kbit/s. I just can't figure out what is causing it. I want to know what process or program in using my network like that?

I do ssh into different machines and servers, where I would really like to be able to monitor bandwidth usage. It would be very useful to know which utilities people use to see what bandwidth is being used and by which applications / programs / processes / or threads. I don't even know where to start looking.

The two small programs I have found are insufficient. bmon and bwm-ng And tools like wireshark (packet sniffers) are overkill. I would like something in the middle, preferably text console-based.

nelaaro

Posted 2011-06-08T10:17:27.867

Reputation: 9 321

Answers

11

You can use

iptraf

or

iftop -P

to identify connections that consume much of your bandwidth. A connection is identified by a pair of (localip:port, remoteip:port). You can then use

netstat -tunp

to look up what process uses that connection. Mostly however, you will be able to tell what service is responsible only by looking at the port, e.g. if the connection uses localip:80 on the local side its probably your webserver ;-)

barbaz

Posted 2011-06-08T10:17:27.867

Reputation: 2 696

11

Well, there is iftop but that only shows the source and destination, not the program causing the traffic.

Edit:

Just found nethogs. It does exactly what you want.

Let_Me_Be

Posted 2011-06-08T10:17:27.867

Reputation: 1 364

0

Iftop

It works well showing which ip / hosts the bandwidth is being used by. It can isolate the information down to a single program or port.

sudo Iftop

once it is running you can the access the help menu with H or ?. Which has numerous useful options

Host display:                          General:
 n - toggle DNS host resolution         P - pause display
 s - toggle show source host            h - toggle this help display
 d - toggle show destination host       b - toggle bar graph display
 t - cycle line display mode            B - cycle bar graph average
                                        T - toggle cummulative line totals
Port display:                           j/k - scroll display
 N - toggle service resolution          f - edit filter code
 S - toggle show source port            l - set screen filter
 D - toggle show destination port       L - lin/log scales
 p - toggle port display                ! - shell command
                                        q - quit
Sorting:
 1/2/3 - sort by 1st/2nd/3rd column
 < - sort by source name
 > - sort by dest name
 o - freeze current order

iftop, version 0.17

nelaaro

Posted 2011-06-08T10:17:27.867

Reputation: 9 321

-2

Solution :VnStat PHP: A Web Based Interface for Monitoring Network Bandwidth Usage

VnStat PHP a graphical interface application for most famous console mode network logger utility called “vnstat“. This VnStat PHP is a graphical frontend to VnStat, to view and monitor network traffic bandwidth usage report in nicely graphical format. It display IN and OUT network traffic statistics in hourly, days, months or full summary.

Reference link: http://www.tecmint.com/vnstat-php-frontend-for-monitoring-network-bandwidth/

Shailesh

Posted 2011-06-08T10:17:27.867

Reputation: 323

-3

The SSH System Administration Tool has facilities for bandwidth monitoring.

user1381775

Posted 2011-06-08T10:17:27.867

Reputation: 1

2This doesn't really answer the question... If this program does it, include instructions – Canadian Luke – 2013-07-24T01:58:08.447