lsof

Find which process is using your port

Find which process is using your port

Sam
At times, you get address in use error for web servers in development environment. Use lsof to find out the process using the port. # to get all the ports sudo lsof -nP -iTCP -sTCP:LISTEN # to get a particular port sudo lsof -nP -iTCP:3000 -sTCP:LISTEN

Important Network Commands in Linux

1. lsof lsof -i To find the process which uses a port 8080, lsof -i :8080 To find the process which uses a TCP port 3005, lsof -i tcp:3005 I often have trouble finding a process which uses a port. I used the lsof command to find the process which uses a port. then I kill the process using the kill command. kill -9 PID