I am trying to get all the processes listening for a network connection on Mac OS X. netstat does not have the -p option and I am trying with lsof
lsof -i -sTCP:LISTEN
gives me a fair list of listening processes but not all. I can for example telnet to port 10080 where I have a process listening for a connection but this is not shown in the output of lsof. What am I missing?
$ telnet localhost 10080
Trying ::1...
Connected to localhost.
Escape character is '^]'.
^]
telnet> Connection closed.
but
$ sudo lsof -n -i | grep 10080
$
amandainstead of 10080? – Jon Lin Dec 15 '11 at 13:56-nonly affects addresses and not ports. To get port numbers I have to use-Ptoo. Thanks – Matteo Dec 15 '11 at 14:35lsof -i -sTCP:LISTEN, and it without the-nand it didn't reveal the 10080 too. So you have to use the-P. – Hanan N. Dec 15 '11 at 17:30