Discussion:
netstat - how to show PID
(too old to reply)
Miroslav Kubik
2005-08-30 13:38:04 UTC
Permalink
Hello

Is there a way how to show PID which belongs to the socket by netstat
command? I searched man pages but I haven't found any useful switch for my
need. I searched in Linux man pages for netstat as well and it seems that
Linux can do it by "p" switch.

"-p, --program
Show the PID and name of the program to which each socket belongs."

But what about OpenBSD?

Thank you
Miroslav Kubik
Simon Dassow
2005-08-30 13:49:06 UTC
Permalink
Post by Miroslav Kubik
Is there a way how to show PID which belongs to the socket by netstat
command? I searched man pages but I haven't found any useful switch for my
need. I searched in Linux man pages for netstat as well and it seems that
Linux can do it by "p" switch.
"-p, --program
Show the PID and name of the program to which each socket belongs."
But what about OpenBSD?
man fstat

Regards,
Simon

P.S.: Missing Xref in netstat?
Spruell, Darren-Perot
2005-08-30 15:38:30 UTC
Permalink
Post by Miroslav Kubik
Is there a way how to show PID which belongs to the socket by netstat
command? I searched man pages but I haven't found any useful
switch for my
need. I searched in Linux man pages for netstat as well and
it seems that
Linux can do it by "p" switch.
You can also use lsof from ports.
Post by Miroslav Kubik
sudo lsof -i:514
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
syslogd 30119 _syslogd 3u IPv4 0xd69d8000 0t0 UDP *:syslog

DS
Jason McIntyre
2005-09-06 23:38:31 UTC
Permalink
Post by Simon Dassow
Post by Miroslav Kubik
Is there a way how to show PID which belongs to the socket by netstat
command? I searched man pages but I haven't found any useful switch for my
need. I searched in Linux man pages for netstat as well and it seems that
Linux can do it by "p" switch.
"-p, --program
Show the PID and name of the program to which each socket belongs."
But what about OpenBSD?
man fstat
Regards,
Simon
P.S.: Missing Xref in netstat?
i just added some references to make the various stat pages (some of
them anyway) cross-reference each other.

jmc

Loading...