List processes listening on TCP ports on Mac OS X using lsof

lsof -i | grep LISTEN | grep "TCP \*:" | sort

Or to find out what processes have open connections use

lsof -i | grep ESTABLISHED | sort

Nothing ground breaking, but useful. netstat gives you similar info, but doesn’t include the process.

Advertisements

One thought on “List processes listening on TCP ports on Mac OS X using lsof

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s