#! /bin/bash # # A quick script to see who (DNS names) are on the same subnet. # Assumes eth0 and /24. # # Usage: onMySubnet [ip] # # George Jones , Wed Sep 30 05:50:02 2015 # eth0Addr=`ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` addrWith4Octets="${1:-${eth0Addr}}" addrWith3Octets=`echo $addrWith4Octets | cut -d"." -f1-3` i=1; while [ "$i" -lt 255 ]; do host ${addrWith3Octets}.$i | grep -v NX; i=$((i+1)); done