send ICMP ECHO_REQUEST to network hosts
# ping -h Usage: ping [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface] [-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos] [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option] [-w deadline] [-W timeout] [hop1 ...] destination
# man ping -c count Stop after sending count ECHO_REQUEST packets. -f Flood ping. -s packetsize Specifies the number of data bytes to be sent. -i interval Wait interval seconds between sending each packet. The default is to wait for one second between each packet normally, or not to wait in flood mode. -w deadline Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received. -R ping only. Record route.
# ping 192.168.0.1 | while read pi; do echo "$(date '+[%Y/%m/%d %H:%M:%S]') $pi"; done
# ping -i 0.1 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=0.575 ms 64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.671 ms 64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.785 ms 64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=1.00 ms 64 bytes from 192.168.0.1: icmp_seq=5 ttl=64 time=0.777 ms 64 bytes from 192.168.0.1: icmp_seq=6 ttl=64 time=5.45 ms 64 bytes from 192.168.0.1: icmp_seq=7 ttl=64 time=0.633 ms 64 bytes from 192.168.0.1: icmp_seq=8 ttl=64 time=0.631 ms 64 bytes from 192.168.0.1: icmp_seq=9 ttl=64 time=0.844 ms 64 bytes from 192.168.0.1: icmp_seq=10 ttl=64 time=0.890 ms 64 bytes from 192.168.0.1: icmp_seq=11 ttl=64 time=0.755 ms 64 bytes from 192.168.0.1: icmp_seq=12 ttl=64 time=1.05 ms ^C --- 192.168.0.1 ping statistics --- 12 packets transmitted, 12 received, 0% packet loss, time 1105ms rtt min/avg/max/mdev = 0.575/1.173/5.459/1.300 ms
# ping -R 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(124) bytes of data. 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.676 ms RR: 192.168.0.22 192.168.0.1 192.168.0.1 192.168.0.22 64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=1.04 ms (same route) 64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=1.05 ms (same route) 64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=0.987 ms (same route) ^C --- 192.168.0.1 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3003ms rtt min/avg/max/mdev = 0.676/0.940/1.057/0.157 ms
# ping -f 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. .^ --- 192.168.0.1 ping statistics --- 1263 packets transmitted, 1263 received, 0% packet loss, time 486ms rtt min/avg/max/mdev = 0.225/0.350/3.052/0.141 ms, ipg/ewma 0.385/0.360 ms