Skip to content

List which apps are listening on network ports (netstat / lsof) — by grg on Ask Different

intermediateforumCC BY-SA (Stack Exchange; version depends on post date)

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

  1. sudo lsof -PiTCP -sTCP:LISTEN
  2. netstat -anvp tcp | awk 'NR<3 || /LISTEN/'

Paraphrased from the source. Menus can differ by version, so check the original for full details.

Read the full thread on apple.stackexchange.com

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

netstatlsofportsnetworkingterminal

More in Community Answers (Stack Exchange)