Who knew that OS X has a command line port scanner? I for one didn’t. I’ve always just used the Network Utility version. Here’s how to access it.

As the superuser run this:

ln /Applications/Utilities/Network\ Utility.app/Contents/Resources/stroke /bin/stroke
chmod uo+x /bin/stroke

Then as any user you can call it from the terminal as such:

stroke address startPort endPort`

So to check your local machine do:

stroke 0 1024

You should see output that looks similar to this:

Port Scanning host:

         Open TCP Port:         80              http
         Open TCP Port:         631             ipp