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.

VS

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!

This entry was posted in Tips and tagged , , , . Bookmark the permalink.
  • http://thinkaround.blogspot.com/ Saager Mhatre

    Methinks pgrep is old-skool enough to work consistently enough across Unixen and Linuxes.

  • Tatiana

    Hi!  My name is Tatiana and I’m a journalist in Bloopies
    company (www.blopies.com) an company that
    work about SEO. I wrote to you to participate in a OLX campaign. I’d like you
    write the article for us. Your blog has the ‘face’ for this work. The
    payment will be made to your Paypal account. If you liked the proposal, write to me and I
    will explain details of that work.

    Cheers,

    Tatiana A
    Dias