Monday, June 24, 2013

List processes and ports on Mac

  • Show listening ports
lsof -i -nP | grep LISTEN
or with all processes
sudo lsof -i -nP | grep LISTEN
  • Show ports with any state, e.g. ESTABLISHED, CLOSE_WAIT, CLOSED, LISTEN
sudo lsof -i -nP | grep TCP
or
sudo lsof -i -nP | grep UDP
Switches
-i select IPv[46] files
-n no host names
-P no port names

Refs
http://hints.macworld.com/article.php?story=20070425165628961

No comments:

Post a Comment