How to list process connected to tcp port?

Hey guys,

I need to kill the process that is currently connected to port 10540. I'm on HP-UX machine.

Below is the result of my netstat.

$ netstat -an |grep 10540
tcp        0      0  129.0.0.1.10540  *.*                     LISTEN

We don't have lsof command, but we have fuser.

I found the command "fuser -n tcp 22" but the -n option is not available on HP-UX machines.

Any help would be greatly appreciated.

netstat -pa

should give the PIDs

Hi Raj,

Here's the result of netstat -pa

$ netstat -pa
a: unknown protocol or uninstrumented protocol

I've also tried "netstat -p tcp" but didn't find any useful info.

Ok. Sorry. I gave the option for linux. For HPUX, I find a related thread here...

http://www.unix.com/hp-ux/47715-find-pid-port-number.html

not sure if this gives any solution...