by aaronblohowiak · 15y ago · 0 comments
Similarly, most versions of lsof support built-in filtering of TCP ports by status:
lsof -iTCP -sTCP:LISTEN -P
will show you the open TCP ports without having to use grep (which discards the header.)