Which application is running on X port?

In Linux we can find the port to pid mapping, using netstat -np or using lsof. However, this facility is not available in Solaris. We will have to write a small perl/shell script to find the mapping.

Script :

#####################
#!/bin/bash
export PORT=0
for name in `ps -aef | awk '{print $2}'`
do
export PORT=`pfiles $name | grep sockname | awk '{print $5}' 2>/dev/null`
if [ -n "$PORT" ]; then
echo "PID = $name PORT= $PORT"
fi
done
unset PORT
exit

####################

Comments

Popular posts from this blog

zpool and power path partial compatibility

Recoverpoint replication reporting with vmax splitter

Weird problem post power maintenance, no Powerpath pseudo name for Luns