Home » Odeon Blogs » Calvin, Weaver »

List open ports on Mac OS X

List open ports on Mac OS X

Mac OS X is unix-based, which for all practical purposes for the software developer/system administrator implies that some of the useful linux commands like netstat isn't available in your Mac Terminal.

On a linux machine, listening to the various open ports on it is as simple as running:

  1. netstat -atp | grep -i "listen"
On your Mac OS X machine, this is what you need to do instead:

  1. sudo lsof -i -P | grep -i "listen"
lsof essentially lists (like "ls") information about files opened by your processes.  An open file includes
  • a regular file,
  • a directory,
  • a block special file,
  • a character special file,
  • an executing text reference,
  • a library,
  • a stream or
  • a network file (Internet socket, NFS file or UNIX domain socket)
There you go. One more step towards becoming a Mac OS X superuser. :-)



Category: OS X


Tagged as: lsof mac os x



Leave a Comment :

(required)


(required)




(required)




(required)






Leave a Comment


Page generated in: 0.17s