Friday, March 22, 2013

PCP script to find open TCP ports and PIDs related in Solaris

 

logo-solaris

PCP script to find open TCP ports and PIDs related in Solaris

PCP is a very useful security and adminitration script that can help you quickly find Processes (PIDs) having particular TCP Port(s) open, TCP ports open by specific PIDs or even list all the TCP Ports open by all PIDs running on your system.

The PCP script works on Solaris 10/9/8 and can be downloaded from here. Simply save the pcp.txt file to your Solaris Server as a Shell scripts (say pcp.sh) and change permissions to execute.
# chmod 755 pcp.sh

PIDs for TCP Port

Run PCP with “-p” option to show the PIDs of processes having a TCP port (say Port 22)

For instance, to find PIDs opening TCP port 22.

pcp1

TCP Ports open by PIDs

Run PCP with “-P” option to show the TCP ports open by specific PID

For instance, here I try to find the TCP ports open by PID 18805

pcp3

 

All PIDs for all open TCP Ports

Use the “-a” option to list all TCP ports open with all the PIDs

 

pcp2

 

Please let me know if you have any queries.

No comments:

Post a Comment