Who’s LISTENing?
January 22nd, 2008 by ravi

Sometimes its useful to know who’s LISTENing on a socket. On GNU/Linux and similar systems, the command netstat -lp provides a listing of all sockets on which processes on your system are listening for connections, along with the process IDs/names of these processes. Unfortunately, it seems the MacOS (Leopard) version of netstat does not support the -p option. Fortunatly, Leopard does come with that Swiss army knife of process and file info, lsof, which among other things can display socket info.

For instance, to find the process that was listening on port 3000 on my system, I used: lsof -i 4:3000. The -i arg is used to specify the type of socket/connection we are looking for, the 4 denotes IPv4 and the 3000 is of course the port we are interested in.

Leave a Reply

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

If you need help with one of my software projects, please click: Using that link, you might even find a previous report of (and solution for) the issue!
SIDEBAR
»
S
I
D
E
B
A
R
«
»  Substance: WordPress  »  Style: Ahren Ahimsa