If you are used to Linux, you might have been used to the following command
netstat -atp | grep -i "listen"
In OS X netstat doesn’t work in the exact same way, and you can use the
A simple way of listing your open and listening ports in OS X
sudo lsof -i -P | grep -i "listen"