To show list of PID on a port:
lsof -t -i :YOUR_PORT_NUMBER
top
command will show a list of all running processes and various statistics about each process. It’s usually most helpful to sort by processor usage or memory usage, and to do that you’ll want to use the -o flag
top -o cpu | grep :YOUR_PORT_NUMBER
shows details of the respective pid
To kill a process by PID:
kill :YOUR_PORT_NUMBER
Sources