Operating System - HP-UX
1820131 Members
3003 Online
109619 Solutions
New Discussion юеВ

How to find which porcess is 'listening' on certain port

 
SOLVED
Go to solution
Amod Phadke
Occasional Advisor

How to find which porcess is 'listening' on certain port

Hi,

when I do 'netstat -a' I get the following output for a port (7500)

tcp4 0 0 *.7500 *.* LISTEN

I want to know which process is listening on this port. I don't get any conclusive report from 'ps -ef'.
Tomorrow never comes if you don't have today.
6 REPLIES 6
Patrick Chim
Trusted Contributor
Solution

Re: How to find which porcess is 'listening' on certain port

Hi,

You can use 'lsof' and can be downloaded in

http://hpux.cs.utah.edu/

e.g. lsof -i tcp:7500

and then it will give you the process id that listening on this port

Hope this help !

Regards,
Patrick
V. V. Ravi Kumar_1
Respected Contributor

Re: How to find which porcess is 'listening' on certain port

hi,
lsof is useful in this case. search forums for lsof, u will find lot of answers.
#lsof -i:7500
will list all the processes which use this port.

regds
Never Say No
Juan Manuel L├│pez
Valued Contributor

Re: How to find which porcess is 'listening' on certain port

Please, I try to use lsof on my hpux machine, so does not work because the runtime of my machine is 64 and lsof downloaded is 32...where can I find lsof 64 bits ?
Thanks. Juanma.
I would like to be lie on a beautiful beach spending my life doing nothing, so someboby has to make this job.
V. V. Ravi Kumar_1
Respected Contributor

Re: How to find which porcess is 'listening' on certain port

hi,
iam attaching lsof binary. unshar it (sh lsof64.shar) and use it. it generates one execuatable and man page. hope it will be useful.

regds
Never Say No
Amod Phadke
Occasional Advisor

Re: How to find which porcess is 'listening' on certain port

Try ftp://ftp.cerias.purdue.edu/pub/tools/unix/sysutils/lsof

AMOD.
Tomorrow never comes if you don't have today.
Yogeeraj_1
Honored Contributor

Re: How to find which porcess is 'listening' on certain port

hi,

lsof should work!
E.g.
============================================================
$ /home/lsof -i:1521
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
oracle 19677 ias902 14u inet 0x4a997380 0t6924 TCP myserver.home.mu:49870->slx
2.cmt.mu:1521 (ESTABLISHED)
tnslsnr 19702 ias902 8u inet 0x4a427b40 0t0 TCP *:1521 (LISTEN)
tnslsnr 19702 ias902 9u inet 0x4abd8980 0t6924 TCP myserver.home.mu:1521->slx2
.cmt.mu:49870 (ESTABLISHED)
$ pwd
============================================================

I downloaded the source and compiled it on my HP-UX 11.11. It is working fine ;)

Hope this helps!
Best Regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)