Tuesday, May 6, 2008

'Established' connections

I wanted to find out a unique list of IPs currently connected to my Solaris web server.
Here is a quick one liner (not exactly) to do the same.


netstat -an | grep EST | perl -lane '$t{$1}++ if \
$F[1]=~/(\d+\.\d+\.\d+\.\d+)\.\d+/; \
END{foreach $key (sort keys %t) {print $key ;}}'



No comments: