Method: We can write our
own script using the ping command to query list of IP addresses and check
whether they are alive or not
as follows:
#!/bin/bash
#Filename:
ping.sh
# Change
base address 192.168.0 according to your network.
for ip
in 192.168.0.{1..255} ;
do
#Amount of packets transmitted "-c 2"
#/dev/null is a virtual file. This will discard anything written to it.
ping $ip -c 2 &> /dev/null ;
if [ $? -eq 0 ];
then
echo $ip is alive
fi
done
The
output is as follows:
$
./ping.sh
192.168.0.1
is alive
192.168.0.90
is alive