以下说明基于macOS环境:
先看示例:
ping -i 0.1 -c 20 -s 20 -t 3 www.baidu.com
PING www.a.shifen.com (61.135.169.125): 20 data bytes
Request timeout for icmp_seq 0
28 bytes from 61.135.169.125: icmp_seq=0 ttl=49 time=198.465 ms
28 bytes from 61.135.169.125: icmp_seq=1 ttl=49 time=200.716 ms
28 bytes from 61.135.169.125: icmp_seq=2 ttl=49 time=193.710 ms
28 bytes from 61.135.169.125: icmp_seq=3 ttl=49 time=199.335 ms
28 bytes from 61.135.169.125: icmp_seq=4 ttl=49 time=191.574 ms
28 bytes from 61.135.169.125: icmp_seq=5 ttl=49 time=193.570 ms
28 bytes from 61.135.169.125: icmp_seq=6 ttl=49 time=192.649 ms
28 bytes from 61.135.169.125: icmp_seq=7 ttl=49 time=193.747 ms
28 bytes from 61.135.169.125: icmp_seq=8 ttl=49 time=192.913 ms
28 bytes from 61.135.169.125: icmp_seq=9 ttl=49 time=190.853 ms
28 bytes from 61.135.169.125: icmp_seq=10 ttl=49 time=192.092 ms
28 bytes from 61.135.169.125: icmp_seq=11 ttl=49 time=209.994 ms
28 bytes from 61.135.169.125: icmp_seq=12 ttl=49 time=339.167 ms
28 bytes from 61.135.169.125: icmp_seq=13 ttl=49 time=379.384 ms
28 bytes from 61.135.169.125: icmp_seq=14 ttl=49 time=310.068 ms
28 bytes from 61.135.169.125: icmp_seq=15 ttl=49 time=209.108 ms
28 bytes from 61.135.169.125: icmp_seq=16 ttl=49 time=337.919 ms
28 bytes from 61.135.169.125: icmp_seq=17 ttl=49 time=247.078 ms
28 bytes from 61.135.169.125: icmp_seq=18 ttl=49 time=183.761 ms
28 bytes from 61.135.169.125: icmp_seq=19 ttl=49 time=178.071 ms
--- www.a.shifen.com ping statistics ---
20 packets transmitted, 20 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 178.071/226.709/379.384/60.002 ms
- -c count 当发送(接受)count个数的数据包后终止。
- -i wait 每个包之间发送的等待时间,只有super-user 可以指定低于0.1s
- -s packetsize 制定发送包的数据大小,默认值为56
- -t timeout 超时时间,指定ping退出之前的超时,无论收到了多少个数据包。
round-trip: 最小值,平均值,最大值,标准差。
注意,-s 如果低于8,则没有统计信息。实际测试发现,等于8可能也没有。所以我使用的是20。
请注意:相同的参数在不同的平台可能有不同的意思,请以各自平台为准。
网友评论