ping - test if a host is reachable on a network by sending ICMP ECHO_REQUEST to network host.
By default ping will continue to ping the host until user press Ctrl+C. use -c option to set the number of times.
Syntax
1
ping [OPTIONS] host_name_or_ip
Options
Common Option
Description
-c count
specify number of times
-i seconds
sets interval in seconds between request. default is 1 second
-O
display a message if no response was received
-s packetsize
Specifies the number of data bytes to be sent. The default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.
Examples
Ping a host 5 times
1
ping -c 5 yahoo.com
Sample output
1 2 3 4 5 6 7 8 9 10
PING yahoo.com (72.30.35.9) 56(84) bytes of data. 64 bytes from media-router-fp1.prod1.media.vip.bf1.yahoo.com (72.30.35.9): icmp_seq=1 ttl=53 time=31.2 ms 64 bytes from media-router-fp1.prod1.media.vip.bf1.yahoo.com (72.30.35.9): icmp_seq=2 ttl=53 time=85.0 ms 64 bytes from media-router-fp1.prod1.media.vip.bf1.yahoo.com (72.30.35.9): icmp_seq=3 ttl=53 time=311 ms 64 bytes from media-router-fp1.prod1.media.vip.bf1.yahoo.com (72.30.35.9): icmp_seq=4 ttl=53 time=816 ms 64 bytes from media-router-fp1.prod1.media.vip.bf1.yahoo.com (72.30.35.9): icmp_seq=5 ttl=53 time=430 ms
--- yahoo.com ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4005ms rtt min/avg/max/mdev = 31.239/335.017/816.803/281.583 ms
Display a message if no response was received
1
ping -O microsoft.com
Sample output
1 2 3 4 5 6 7
PING microsoft.com (13.77.161.179) 56(84) bytes of data. no answer yet for icmp_seq=1 no answer yet for icmp_seq=2 no answer yet for icmp_seq=3