Determine what process is listening on a port on Solaris, without lsof

Image by Metsuke iLife via Flickr

$ for x in `ptree | awk \'{print $1}\’`; do pfiles $x | grep ${PORT} > /dev/null 2>&1; if [ x\”$?\” == \”x0\” ]; then ps -ef | grep $x | grep -v grep; fi; done 2> /dev/null

Can use lsof, but since it\’s not part of the base OS, it\’s not always available.



About Amit Agarwal