0

Is it possible to pipe an executable script through a utility that shows what network connections the script is making [in real time]? I was thinking I might be able to use netstat and connect to that PID, but it doesn't seem to take a PID as an argument (only procotol, int, port etc).

1
  • netstat can show what PID is making connections/listening for connections though. It just can't filter the output that way.
    – Lawrence
    Jul 3, 2014 at 2:47

1 Answer 1

1

You can pipe netstat with a grep doing the following:

sudo netstat -pa | grep "PID/"

where PID must be replaced by the PID of your process.

To get real time update, you can use watch, for example (with PID=1234):

sudo watch -n1 'netstat -pa | grep "1234/"'

If you want only network connection and not Linux socket, you can event use:

sudo watch -n1 'netstat -ptua | grep "1234/"'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .