Sunday, November 24, 2013

Quick ping-scanning a network using bash

So you want to know who answers to pings in said network or IP range?
Certainly not the best way to map a network, but it's useful enough to find a forgotten IP number without having to check with your DHCP:

$ for ip in 10.0.0.{000..255};do ping -c1 -t1 $ip > /dev/null 2>&1 && echo "${ip} is up" & done|grep up|sort

This method can also be used to run multiple commands in multiple terminal windows by using gnome-terminal -e "your command here".