for n in {1..254}
do
ping -W 2 -c 2 10.0.0.$n &>/dev/null
if [ $? -eq 0 ]
then
echo "10.0.0.$n is alive."
else
echo "10.0.0.$n is dead."
fi
done
for n in {1..254}
do
{
ping -W 2 -c 2 10.0.0.$n &>/dev/null
if [ $? -eq 0 ]
then
echo "10.0.0.$n is alive."
else
echo "10.0.0.$n is dead."
fi
}&
done
[root@web01 scripts]# nmap -sP 10.0.0.0/24|awk '/Nmap scan report for/ {print $NF}'
10.0.0.1
10.0.0.8
10.0.0.9
10.0.0.61
10.0.0.254
(10.0.0.7)
-sP: Ping Scan - go no further than determining if host is online