Script for Check Bulk IP Ping / Status / Health | Linux


Sharing Basic script which I have shared in Some LUG before few months.

Sharing it here because it will help to people who wants to check PING of Bulk IP Addresses and check status and health by pinging the IP Address.

Again repeating this is very basic script and many changes required to improve, You can suggest me or you can send me improve one so i will update it over here. Your Suggestions are always welcome.

Requirements to run Script :-
1. One File which contains all IPs. One IP per line.
2. If you have different class, From system which you are running this script must contact those hosts. Routing must be through to get ping.
# Below is example file. which is containing IP List
[root@tejas-barot-lenovo ~]# cat /root/ping.txt
#Below is script which will helps you. Script is not dynamic with variable and all
[root@tejas-barot-lenovo ~]# cat /root/
####### Script Starts from here ######
# -c3 = is ping count, It will ping for 3 times, You can increase or decrease this number.
for PNG in $(cat /root/ping.txt)
ping -c3 $PNG > /dev/null 2>&1
if [ $VAL = 0 ] ; then
echo “Success Ping… Host $PNG is up”
echo “No Ping…Host $PNG is Down”
##### Script Ends here ##
You can also you fping :
As Normal User, fping will not allow you to specify -f, -f is allowed for root only.
As a Normal user you can try, even as root you can try following :-
$ fping < <file-name-with-ips>

# fping < <file-name-with-ips>

Hope this will helps you.
Enjoy Linux 🙂 Enjoy Scripting 🙂  Enjoy Open Source 🙂

Please Keep in Touch with Social Networking :- 
Facebook Page :-

2 thoughts on “Script for Check Bulk IP Ping / Status / Health | Linux”

  1. hi, nice write up. the script you posted is helpful and ok but can be improved as in:

    while read IP; do
    ping -c3 ${IP} &> /dev/null;
    if [[ $? -eq 0 ]]; then
    echo "${IP} is UP"
    echo "${IP} is DOWN"
    done < <(cat /tmp/ips.txt)

    thanks and keep up the good work 😉

Leave a Reply

Your email address will not be published. Required fields are marked *