List which apps are listening on network ports (netstat / lsof) — by grg on Ask Different
macOS's netstat doesn't take Linux's -p flag for process names. The answer gives a netstat filter for listening TCP sockets, and an lsof command that shows the program name and process ID for each listening port.
Quick steps
- sudo lsof -PiTCP -sTCP:LISTEN
- netstat -anvp tcp | awk 'NR<3 || /LISTEN/'
Paraphrased from the source. Menus can differ by version, so check the original for full details.
Source: List which apps are listening on network ports (netstat / lsof) by grg on Ask Different. Licence: CC BY-SA (Stack Exchange; version depends on post date).
- Source reviewed
- 2026-11-02
- Link checked
- Not yet
- Tested hands-on
- Not by Oddbyte.Me