Linux, Script

Multi IP Ping Host Table

Create bash script to quick ping all the hosts from ip list text file.

By using basic command grep & ping,  one script to check unlimited Host live or not by ping response.
[[email protected] ~]$ vi ip.txt

[[email protected] ~]$ vi ping-check.sh
—– Copy Script —–

#!/bin/sh
 grep -v "#" ip.txt | awk '{print $1}' | while read host
 do
 ping -c 1 $host
 done


Note: Do not keep blank lines in file other wise your and your mileage may differ slightly.
Give executable permission to .sh script
[[email protected] ~]$ chmod +x ping-check.sh
Run the script
[[email protected] ~]$ sh ping-check.sh
Get the output

By getting this output you will see the host response.
Enjoy..