Posts

Showing posts from August, 2011

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 ####################