cancel
Showing results for 
Search instead for 
Did you mean: 

How to find out the service that consumes a given port?

Former Member
0 Kudos

If we want to check if a given port is open on a given host, we do

telnet hostname port-number

If this given port is open, that means a service is consuming this port. How to identify which

service is consuming this open port?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

sunny_pahuja2
Active Contributor
0 Kudos

hi ,

If you want to check which application is using a port then you can check with netstat -a or lsof -i tcp:<port no> on a host..

also check /etc/hosts which shows which port are used by different systems or applications..

Thanks

Sunny

Former Member
0 Kudos

Thanks !

However,

1) netstat can ONLY tell which ports are in use. But it cannot tell which service is consuming which port.

2) command lsof is not recognized by NT, please advise more.

Thanks again. Need help.

sunny_pahuja2
Active Contributor
0 Kudos

Hi,

from netstat command you can find the process id... and then use ps -ef command to grep that process..then you can identify which application is using that port...

Thanks

Sunny

Former Member
0 Kudos

At this moment I have only NT access.

On NT, netstat cannot give PID, and "ps -ef" is a UNIX command.

Please advise more. Thanks!

JPReyes
Active Contributor
0 Kudos

Hi Christy,

If you use switch -o displays active TCP connections and includes PID for each connection

Example

Netstat -ao

Regards

Juan

sunny_pahuja2
Active Contributor
0 Kudos

Hi,

use command netstat -aobn to get the pid and then use command tasklist to identify process corresponds to that pid...

Thanks

Sunny

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Please check the file /etc/services.

In this file you will find that which port is occupied by which services. This file contains all services details (OS+ SAP also).

Please refer to below doc for the details about the standard ports used by SAP applications.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4e515a43-0e01-0010-2da1-9bcc452c...

With Regards,

Saurabh