<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Tech-Recipes - Latest Comments in Find out which process is holding which socket open</title><link>http://tech-recipes.disqus.com/</link><description>Cookbook of Tech Tutorials</description><atom:link href="https://tech-recipes.disqus.com/find_out_which_process_is_holding_which_socket_open_unix_tech_recipes/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Thu, 24 Jun 2010 10:59:59 -0000</lastBuildDate><item><title>Re: Find out which process is holding which socket open</title><link>http://www.tech-recipes.com/rx/227/find-out-which-process-is-holding-which-socket-open/#comment-58449595</link><description>&lt;p&gt;But pfiles stops the process in question while it examines it.&lt;br&gt;I would not recommend using pfiles in productive environments.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Daniel</dc:creator><pubDate>Thu, 24 Jun 2010 10:59:59 -0000</pubDate></item><item><title>Re: Find out which process is holding which socket open</title><link>http://www.tech-recipes.com/rx/227/find-out-which-process-is-holding-which-socket-open/#comment-2767166</link><description>&lt;p&gt;Just use /usr/proc/bin/pfiles &amp;lt;pid&amp;gt;   bit of a pain to do it in reverse (i.e. speicfy pid to get the port) but a simple script can rip thru it for you....&lt;/p&gt;&lt;p&gt;echo "which port?&amp;gt; "&lt;br&gt;read port&lt;/p&gt;&lt;p&gt;for pid in `ps -ef -o pid | tail +2`&lt;br&gt;do&lt;br&gt;        foundport=`/usr/proc/bin/pfiles $pid 2&amp;gt;&amp;amp;1 | grep "sockname:" | grep "por&lt;br&gt;t: $port$"`&lt;br&gt;        if [ "$foundport" != "" ]&lt;br&gt;        then&lt;br&gt;                echo "proc: $pid, $foundport"&lt;br&gt;        fi&lt;br&gt;done&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Guest</dc:creator><pubDate>Tue, 17 Aug 2004 16:02:54 -0000</pubDate></item><item><title>Re: Find out which process is holding which socket open</title><link>http://www.tech-recipes.com/rx/227/find-out-which-process-is-holding-which-socket-open/#comment-2767165</link><description>&lt;p&gt;netstat -anp works on linux, but not Solaris :-(&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Tue, 15 Jun 2004 05:35:05 -0000</pubDate></item><item><title>Re: Find out which process is holding which socket open</title><link>http://www.tech-recipes.com/rx/227/find-out-which-process-is-holding-which-socket-open/#comment-2767164</link><description>&lt;p&gt;Actually, you can skip a whole step there... if you add the '-p' argument to netstat, it includes the PID of the process in question!&lt;/p&gt;&lt;p&gt;So instead of netstat -an, try netstat -anp.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Wed, 07 Jan 2004 07:41:02 -0000</pubDate></item></channel></rss>