Last Updated: February 25, 2016
·
286
· liorkesos

What process is listening to port - OSX

Working alot with mean.io I need to start and restart the system using gulp pretty frequently.
Sometimes I have stray node processes (mainly 35729) which block my execution because they are allready bound to the port.

I did not find an easy one liner which was easy to use to find the process and kept pasting

lsof -n -i4TCP:$PORT | grep LISTEN

I added the next function in my .bash_profile..

function pslisten {
  echo `lsof -n -i4TCP:$1 | grep LISTEN`
}

and now run pslisten 35729 to see who is grabing my port