How to know which application is using which port on Mac and Solaris
By pierrot on Mar 13, 2009
I am using often so...
lsof -i -P | grep -i "listen"
Here it is a little more complex.
I got a little script from the net that does that: give it the port you want to scan and it will give you the app using it.
opensolaris [~/bin] $ get_pid_from_port.sh
Please provide a port number parameter for this script
e.g. %content 1521
# is the port we are looking for
if [ $# -lt 1 ]
echo "Please provide a port number parameter for this script"
echo "e.g. %content 1521"
echo "Greping for your port, please be patient (CTRL+C breaks) ~E "
for i in `ls /proc`
pfiles $i | grep AF_INET | grep $1
if [ $? -eq 0 ]
echo Is owned by pid $i