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

2010-06-08 0 words 0 mins read

Image by Metsuke iLife via Flickr

$ for x in `ptree | <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="">awk '{print $1}&#8217;`; do pfiles $x | <a class="zem_slink freebase/en/grep" title="Grep" rel="wikipedia" href="">grep ${PORT} > /dev/null 2>&1; if [ x&#8221;$?&#8221; == &#8221;x0&#8221; ]; then ps -ef | grep $x | grep -v grep; fi; done 2> /dev/null

Can use lsof, but since it&#8217;s not part of the base OS, it&#8217;s not always available.

URL: <a href=""><h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="">Catching erroneous queries, without MySQL proxy ( <li class="zemanta-article-ul-li"><a href="">Django profiling again ( <li class="zemanta-article-ul-li"><a href="">Better Than Grep: ack ( <li class="zemanta-article-ul-li"><a href="">Why InnoDB index cardinality varies strangely ( <li class="zemanta-article-ul-li"><a href="">Rename files the easy way in OS X ( <li class="zemanta-article-ul-li"><a href="">Extract all urls from the last firefox sessionstore.js file used. ( <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href=""><img class="zemanta-pixie-img" src="" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">


Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it