perl & lsof kind

G

gmlvsk2

Is there a perl module that will give me process name for a port?
I would give it open port and it would give me executable name that
listens on that port.
Thank you
 
J

Joe Smith

Is there a perl module that will give me process name for a port?
I would give it open port and it would give me executable name that
listens on that port.

This is what I use:

linux% perl -e 's/\s+(TCP|UDP) / $1 /&&print for `lsof`'
 
C

Chris Davies

Joe Smith said:
Is there a perl module that will give me process name for a port?
I would give it open port and it would give me executable name that
listens on that port.

This is what I use:
linux% perl -e 's/\s+(TCP|UDP) / $1 /&&print for `lsof`'

Just bear in mind that you can have multiple processes listening on the
same port (just on different interfaces). For example, 127.0.0.1:80 is
different to 192.168.1.1:80, and both are different to the wildcarded *:80

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top