In the below example, the PID of the process I am observing is 1114114.
lsof -p 1114114 -a -i TCP -P | perl -ane '$h{(split(":", (split("->", $F[-2]))[-1]))[0]}++ if /ESTABLISHED/; END {for $i (keys %h) {print "$i = $h{$i}\n";}}'
Example output:
bob.example.com = 6 lemon.example.com = 12 smart100.example.com = 60 smart101.example.com = 8 windows.example.com = 2
No comments:
Post a Comment