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:
Then as any user you can call it from the terminal as such:
So to check your local machine do:
You should see output that looks similar to this: