How do determine how much bandwidth a process is using in Linux
Solution 1
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 ;-)
Solution 2
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.
Related videos on Youtube
nelaaro
Linux admin, tech enthusiast. opensource evangelist.
Updated on September 18, 2022Comments
-
nelaaro almost 2 years
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.
-
Canadian Luke almost 11 yearsThis doesn't really answer the question... If this program does it, include instructions