Show your program’s connections (open sockets) on MacOSX Snow Leopard

Sometimes, you might want to know which socket your programming is binding to. Well it’s simple with just one command

lsof -i TCP -i UDP

Combined with other tool like grep, you can view/search for a specific application with its associated opened sockets

lsof -i TCP -i UDP | grep memcached

You will see something like this

memcached 22631 genie    4u  IPv6 0x11a16e20      0t0  TCP *:11211 (LISTEN)
memcached 22631 genie    5u  IPv4 0x0bc55304      0t0  TCP *:11211 (LISTEN)
memcached 22631 genie    6u  IPv6 0x0b36c7bc      0t0  UDP *:11211
memcached 22631 genie    7u  IPv4 0x0b36cc08      0t0  UDP *:11211

Related posts:

Share

About number.0