13 May 2009

Port number to PID

Print out all the PIDs and associated ports.

ps -ef | awk '!/PID/{print $2}' | xargs pfiles 2>/dev/null | awk -F":" '$1~/^[0-9]/{XPID=$1;XCMD=$2};
/port/{print XPID, " ", XCMD, " : \n\t",$0}'

No comments: