Mac OS: netstat and pid

I am a Linux user by large. Lately I migrated to Mac as it worked better for me. (...and they look beautiful!) Although, I found from @hyfather that there is significant difference between Mac based utilities vs Linux-based. This difference exists as Linux has GNU coreutils and Mac has BSD based.

Many switches are different, output is different and it is very frustrating to experienced users.

I ran into netstat command recently. I needed to find out pid of memcached server on my mac. Spend few mins but no luck. Mac based netstat command won't understand -p switch. Aaargh! I had to use lsof to get my job done.

Here is how I did it -

sudo lsof -i -P|grep memcache

Worked great!

Published October 26 2011

blog comments powered by Disqus