Operating System - HP-UX
1820140 Members
3332 Online
109619 Solutions
New Discussion юеВ

Re: Find process ID, using a port number in use

 
SOLVED
Go to solution
Anil Sedha
Advisor

Find process ID, using a port number in use

Hello,

I am trying to find the process ID number and user details which use a particular port number. I found the port number in use using netstat -an

Now, I am trying to find which process is using the port number.

Can someone kindly guide me on this.

Regards and thanks in advance.
I shall update the points once i get the correct answer to all.

Anil
Live, love and let live
5 REPLIES 5
Christopher Caldwell
Honored Contributor
Solution

Re: Find process ID, using a port number in use

lsof is your huckleberry. It's available from the porting archive:

http://hpux.cs.utah.edu/
James R. Ferguson
Acclaimed Contributor

Re: Find process ID, using a port number in use

Hi:

The best tool for this is 'lsof'. For example, to find the process using port 161, do:

# lsof -i tcp:161
# lsof -i udp:161

If you don't have installed (usually in /opt), download it from here:

http://gatekeep.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.64/

Regards!

...JRF...
Sajid_1
Honored Contributor

Re: Find process ID, using a port number in use

hello,

You can make use of 'lsof' utility for doing all these functions. Get it from here, it's free:
http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.64/
learn unix ..
Jeff Schussele
Honored Contributor

Re: Find process ID, using a port number in use

Hi Anil,

You'll have to use the lsof utility & the command would be, I believe:

lsof -i TCP:port#

Of course substitute UDP if it's a UDP port.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Anil Sedha
Advisor

Re: Find process ID, using a port number in use

You guys gave me what i wanted.

Hope you are happy with your points. I appreciate the help you guys provide.

Regards,
Anil
Live, love and let live