Monday, 7 December 2009

Linux find which program is using a port

The linux fuser command has a special option for port conflicts.
Use fuser -n tcp for tcp ports to see which process is using the port.
For example to see which application is already using port 80 use:
$ fuser -n tcp 80
The netstat command can also be used to determine what process is using a port.
Use netstat -nlp and you should see PID and names of programs along with the port they are using (note you can only see the PID of process you own, unless running as root)

$ netstat --nlp

No comments: