May 122009

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 and change permissions to execute.

# chmod 755

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.

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


All PIDs for all open TCP Ports

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


  5 Responses to “PCP script to find open TCP ports and PIDs related in Solaris”

  1. Nice tool,
    thanks for the hint!

  2. how do i learn ur aplication on line. thanx

  3. Good tool to use.
    What is the difference between PCP scripts and PS commands?

  4. great tool!!!!!


    You must NEVER use this tool on a production system. Like most lsof-like scripts for Solaris you can find on the net it is based on the Solaris pfiles command. This command temporarily stops the process in order to inspect it. For some processes/daemons even a short stop will make them crash. Don’t go there, amigo.

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>