In Linux how can I ping a list of IP addresses (in a text file) and only output those that have duplicate ping replies?
If you're talking about duplicates described in the man page:
Duplicate packets should never occur, and seem to be caused by inappropriate link-level retransmissions. Duplicates may occur in many situations and are rarely (if ever) a good sign, although the presence of low levels of duplicates may not always be cause for alarm.
It will produce output like this:
$ ping -n 192.x.y.z PING x.com (192.x.y.z) 56(84) bytes of data. 64 bytes from 192.x.y.z: icmp_req=1 ttl=120 time=51.8 ms 64 bytes from 192.x.y.z: icmp_req=1 ttl=120 time=51.8 ms (DUP!) 64 bytes from 192.x.y.z: icmp_req=1 ttl=120 time=52.3 ms (DUP!)
So you have just to iterate over the list in cycle:
while read ip ; do ping -c4 $ip | grep -q 'DUP!' && echo "$ip duplicates" ; done < ip_list.txt
Where ip_list.txt contains new line separated ip addresses list.