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

2010-06-08 0 words 0 mins read

\"Desktop
Image by Metsuke iLife via Flickr

$ for x in `ptree | <a class="zem_slink freebase/en/awk" title="AWK" rel="homepage" href="http://cm.bell-labs.com/cm/cs/awkbook/index.html">awk '{print $1}&#8217;`; do pfiles $x | <a class="zem_slink freebase/en/grep" title="Grep" rel="wikipedia" href="http://en.wikipedia.org/wiki/Grep">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="http://feedproxy.google.com/~r/Command-line-fu/~3/lV75MK3xrqs/determine-what-process-is-listening-on-a-port-on-solaris-without-lsof">http://feedproxy.google.com/~r/Command-line-fu/~3/lV75MK3xrqs/determine-what-process-is-listening-on-a-port-on-solaris-without-lsof<h6 class="zemanta-related-title">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://www.xaprb.com/blog/2009/11/01/catching-erroneous-queries-without-mysql-proxy/">Catching erroneous queries, without MySQL proxy (xaprb.com) <li class="zemanta-article-ul-li"><a href="http://perro.si/django-profiling-again">Django profiling again (perro.si) <li class="zemanta-article-ul-li"><a href="http://www.ezran.org/blog/2009/10/better-than-grep-ack/">Better Than Grep: ack (ezran.org) <li class="zemanta-article-ul-li"><a href="http://www.mysqlperformanceblog.com/2009/09/28/why-innodb-index-cardinality-varies-strangely/">Why InnoDB index cardinality varies strangely (mysqlperformanceblog.com) <li class="zemanta-article-ul-li"><a href="http://amychr.wordpress.com/2009/04/29/rename-files-the-easy-way-in-os-x/">Rename files the easy way in OS X (amychr.wordpress.com) <li class="zemanta-article-ul-li"><a href="http://blog.amit-agarwal.co.in/2009/12/27/extract-all-urls-from-the-last-firefox-sessionstore-js-file-used/">Extract all urls from the last firefox sessionstore.js file used. (amit-agarwal.co.in) <div class="zemanta-pixie"><a class="zemanta-pixie-a" title="Reblog this post [with Zemanta]" href="http://reblog.zemanta.com/zemified/6a8a250b-e512-4930-bdc9-3d64b17be486/"><img class="zemanta-pixie-img" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b48.png" alt="Reblog this post [with Zemanta]" /><span class="zem-script more-related more-info pretty-attribution paragraph-reblog">


author

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