SUMMARY:process info from netstat

From: jnaneshkalbag <jnaneshkalbag_at_indiatimes.com>
Date: Sun Apr 13 2003 - 23:10:54 EDT
Here is the question I posted.
-----------------------------
> How can i get information regarding the processes that are ESTABLISHED ( out put from netstat) at this port 80.
>
> netstat | grep 80
> -------
> testmach23.80 121.22.37.86.39189 8760 0 32872 0 ESTABLISHED
> testmach23.80 121.22.37.86.59311 8760 0 32872 0 ESTABLISHED
> testmach23.80 121.22.37.86.39255 8760 0 32872 0 ESTABLISHED
>
> I am trying to get the process name that are clinging on to port 80. Is there any other way we can get the processes at this port.

------------------------------------------
Answers:
-------
1> #!/bin/sh

PFILES=/usr/proc/bin/pfiles

PROCS=`ps -ef|awk 'NR>1{print $2}'`

for i in $PROCS
do
if [ -n "`$PFILES $i 2>/dev/null|grep S_IFSOCK`" ]
then
ps -f -p $i| awk 'NR>1{print}'
$PFILES $i 2>/dev/null|awk '/S_IFSOCK/{print $1, $2,
$5}/sockname:/{print}'
fi
done

2> Get lsof from http://freshmeat.net/projects/lsof/ and compile it, or get a prebuilt version from
http://www.sunfreeware.com/ that is appropriate for
whatever Solaris version you are running. You can
then do
lsof -I tcp:80
and it will list the processes on port 80.
-------------------------------------
Many thanks to yura pismerov for the script in answer(1) and Rick anderson/Alexie for answer (2).



Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com

 Buy The Best In BOOKS at http://www.bestsellers.indiatimes.com

Bid for for Air Tickets @ Re.1 on Air Sahara Flights. Just log on to http://airsahara.indiatimes.com and Bid Now!
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Sun Apr 13 23:19:29 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:09 EST