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