Search This Blog

Thursday, March 6, 2008

ping all hosts on the LAN

Today i got a code by which u will get to know which all machines are up in a particular network....

$ for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip>/dev/null; [ $? -eq 0 ] && echo "192.168.1.$ip UP" || : ; done Output:

192.168.1.1 UP
192.168.1.1 UP
192.168.1.2 UP
192.168.1.5 UP
......
...
..
192.168.1.254 UP

No comments: