Command Line – Equivalent of Netstat -tln on OS X

command line

What is the equivalent of Linux's netstat -tln on OS X?

Options:

-l, --listening (Show only listening sockets. (These are omitted by default.)
--numeric , -n (Show numerical addresses instead of trying to determine symbolic host, port or user names.)
-t, --tcp

Best Answer

Should be this command:

sudo lsof -iTCP:$PORT -sTCP:LISTEN 

Who is listening on a given TCP port on Mac OS X?