Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Such known tools like iftop/iptraf display network I/O per interface and per connection. Is there a way to see network I/O statistics per process?

share|improve this question
add comment

2 Answers 2

up vote 20 down vote accepted

nethogs looks like it will do what you want.

EDIT: I needed to install ncurses-devel, libpcap and libpcap-devel to build.

share|improve this answer
1  
great addition to my toolbox, thanks. –  Luke404 Mar 15 '12 at 14:12
add comment

To find what connections are associated with each process, use lsof. For example:

lsof | grep TCP

That will give you a list of connections, like this:

bash    10887 luke    3u     IPv4 44638801      0t0      TCP littleyerry.example.com:55212->barista.example.com:ldap (ESTABLISHED)
bash    10913 luke    3u     IPv4 44638905      0t0      TCP littleyerry.example.com:55216->barista.example.com:ldap (ESTABLISHED)
ssh     10935 luke    3u     IPv4 44639001      0t0      TCP littleyerry.example.com:55219->barista.example.com:ldap (ESTABLISHED)
ssh     10935 luke    4u     IPv4 44639008      0t0      TCP littleyerry.example.com:59459->launchpad.example.com:ssh (ESTABLISHED)
bash    10938 luke    3u     IPv4 44639107      0t0      TCP littleyerry.example.com:55221->barista.example.com:ldap (ESTABLISHED)

From there, you should be able to find out about each connection individually using the tools you mentioned (iftop, iptraf). You could build a small script to aggregate the specific data that you're looking for.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.