Find a process listening on a port
Use lsof -i :port_number
to find details about a process listening on whichever port you pass.
For example, if you were running a local server on port 4000 and wanted to find the server's PID you could run lsof -i :4000