Let us ping!

ping is the most basic network command every user should first know and is available on all major Operating Systems. It is also a diagnostic tool used for verifying the connectivity between two hosts on a network. It can be used to find out which machines are alive on a network. Let us see how to use ping.

How to do it...

In order to check the connectivity of two hosts on a network, the ping command uses Internet Control Message Protocol (ICMP) echo packets. When these echo packets are sent towards a host, the host responds back with a reply if it is reachable or alive.

Check whether a host is reachable as follows:

$ ping ADDRESS

The ADDRESS can be a hostname, domain name, or an IP address itself.

ping will continuously send packets and ...

Get Linux Shell Scripting Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.