Jan 18, 2016

Linux: find which process is listening on a port

A while ago, I couldn't get my WildFly fired up, because some other process was already listening on port 8080. This is how I figured out who it was:
sudo lsof -i :8080 | grep LISTEN
lsof stands for list open files, and that's actually what it does. The good thing is that this also works for network 'files' (i.e. open ports). It generates output like this:
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
tomcat7 1213 tomcat 3u IPv4 14721 TCP *:www (LISTEN)
So, the output showed me that I had a zombie Tomcat running with a process id of 1213 which was easy to fix (kill).

No comments:

Post a Comment