Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get host names of any machines connected to my local network
#!/bin/bash
for i in $(seq 255);
do
nslookup 192.168.1.$(echo $i) 192.168.1.1 >/dev/null;
if [ $? -ne 1 ];
then
echo -n 192.168.1.$i;
nslookup 192.168.1.$(echo $i) 192.168.1.1|grep name|cut -d= -f2;
fi;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment