Port that a process opens up

Hi all,

I have a process with PID as 12456. Could you please let me know how do i find out what is the port that process listens upon in Linux?

Thanks in Advance,

Pankajakshan

Check out the lsof command. You might need to run it as root.

you could use era's idea (lsof -p PID) or do something like netstat -putanuw|grep -E "LISTEN.*(processname|processpid)"

You should change "processname" and "processpid". You could also use just "LISTEN.*processname" or "LISTEN.*pid"