Dec 5, 2012

How to find a process binding a port on linux - lsof doesn't show the port

Today I had the problem, that a running java process was binding a port and
a new installed process tried to start and bind the same port.

How to find out which process is binding that port?

On Solaris/OpenIndiana/Illumos there is no easy way with onboard tools.

The data is hidden in the proc filesystem. For this area I have since a longer
time the script pcp which is doing the parsing in the proc filesystem to search
for the process.

On Linux, I know from former times, that lsof is doing the job.

The simple form here is lsof -i :<port number>, but I didn't get an output?

The problem was, that the process is running with root privileges and I issued
the command as my normal user.

After starting the command with sudo as root, I got the process.