Recipe: Let us ping! ping ==== $ ping ADDRESS $ ping 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=1.44 ms ^C --- 192.168.0.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 1.440/1.440/1.440/0.000 ms $ ping google.com PING google.com (209.85.153.104) 56(84) bytes of data. 64 bytes from bom01s01-in-f104.1e100.net (209.85.153.104): icmp_seq=1 ttl=53 time=123 ms ^C --- google.com ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 123.388/123.388/123.388/0.000 ms When host is unreachable: $ ping 192.168.0.99 PING 192.168.0.99 (192.168.0.99) 56(84) bytes of data. From 192.168.0.82 icmp_seq=1 Destination Host Unreachable From 192.168.0.82 icmp_seq=2 Destination Host Unreachable Set packet count with -c ======================== $ ping 192.168.0.1 -c 2 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=4.02 ms 64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=1.03 ms --- 192.168.0.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 1.039/2.533/4.028/1.495 ms Check for ping status ===================== $ ping domain -c2 if [ $? -eq 0 ]; then echo Successful ; else echo Failure ; fi