Determine what process is listening on a port on Solaris, without lsof
$ 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}’`; 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”$?” == ”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.
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">
Related Articles:
- 2010/05/19 Awk Introduction Tutorial – 7 Awk Print Examples
- 2010/06/04 SQuirrel SQL for Graphical interface to Oracle/MySQL and loads of other database – OSS and free.
- 2010/05/30 Google\’s RE2 regular expression library
- 2010/04/29 Lock the hardware eject button of the cdrom
- 2010/04/21 Convert decimal numbers to binary