SCSA Victor Manuel Murillo Garibay
|
||
Alejandro Callejas Red Hat Certified Technician |
||
Jesus Acosta Red Hat Certified Technician | ||
Edgar Tejada GarcĂa Java Programer |
FIND OPEN TCP PORTS AND PIDs
PCP script to find open TCP ports and PIDs in Solaris
PCP is a 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.
PIDs for TCP Port
Run PCP with "-p" option to show the PIDs of processes having a
TCP port (say Port 22)
Example:
test@mx3 # ksh "pcp.ksh" -p 22
PID Process Name and Port
_________________________________________________________
26308 sshd 22
sockname: AF_INET 10.0.0.7 port: 22
sockname: AF_INET 10.0.0.7 port: 22
sockname: AF_INET 10.0.0.7 port: 22
_________________________________________________________
TCP Ports open by PIDs
Run PCP with "-P" option to show the TCP ports open by specific PID
PIDs for all open TCP Ports
Use the "-a" option to list all TCP ports open with all the PIDs
Many thanks for this Script Sam Nelson and Daniel Trinkle trinkle