1833758 Members
3029 Online
110063 Solutions
New Discussion

Port (TCP) x Process

 
Kiko Azevedo
New Member

Port (TCP) x Process

Hi

Is there a way to know to which process belong a particular port?

Example in port 32773-32779 are known to be for rpc services. But to which process

do they pertain to, that's another issue?

In linux the command is:

# netstat -anp (where "p" is process ID)

Thanks !!!


Marcus Vinicius de O. Azevedo
3 REPLIES 3
Anil C. Sedha
Trusted Contributor

Re: Port (TCP) x Process

If you mean associating a port with a process id, you may use "lsof" to do that.

you can download it and use it.

lsof -i @hostname:port

for more options use lsof -h


Great utility to use.

Regards,
Anil
If you need to learn, now is the best opportunity
Jeff Schussele
Honored Contributor

Re: Port (TCP) x Process

Hi Marcus,

netstat will not give you that info.
Best way to get it is to use the lsof command.
It's a free 3rd party program & available here:

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

It's a tool ALL SAs should have on all systems.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Sundar_7
Honored Contributor

Re: Port (TCP) x Process

Hi,

There is no built in tool. You have to download lsof tool from the net to
achive this.

Once you download and install lsof command then you can use

# lsof -i:portnumber

to find out the processes using the port number

Thanks,

Sundar.
Learn What to do ,How to do and more importantly When to do ?