Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My machine is generating a lot of network traffic, all from the same source port, with many different destinations (found this out by running iftop -P, and from my router's logs).

How do I find the process that is generating this traffic?

share|improve this question
up vote 7 down vote accepted

i would use:

netstat -punta | grep <src port>

it will give you PIDs and binary name for each

share|improve this answer
    
What's the point of specifying -t and -u if -a is given? – tink Oct 28 '12 at 19:38
3  
@tink so you dont get UNIX domain sockets and so you get UDP and TCP in connected or listen states – h3rrmiller Oct 28 '12 at 21:57
    
I find -atup and -atunp faster to type :) – XTL Oct 29 '12 at 6:46
    
@XTL -punta is easier for me to remember because its very close to a naughty word in spanish :D – h3rrmiller Oct 29 '12 at 13:17

You could try something like this (for port 80):

netstat -p --numeric-ports | grep :80

This is not the best solution, but should give the information you need.

share|improve this answer

I have had good luck using nethogs which has an active github repo

sudo apt-get install nethogs

or compile from source

git clone https://github.com/raboof/nethogs.git
cd nethogs
make
sudo make install

... then view traffic, say on your WiFi interface :

sudo nethogs wlan0
share|improve this answer

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.