To list all the ports in use on your machine, do:
netstat -anf inet
To see which process is using a specific port, do:
// sudo lsof -i :<portnumber>
sudo lsof -i :80
The above will list all processes using port 80. To kill a process, do:
// kill -9 <processid>
kill -9 51377