ping 时记录时间戳
2018-12-31 tech linux 1 mins 457 字
参考 stackoverflow这篇问答:How do I timestamp every ping result?
ping www.google.fr | while read pong; do echo "$(date): $pong"; done
将输出如下内容:
Wed Jun 26 13:09:23 CEST 2013: PING www.google.fr (173.194.40.56) 56(84) bytes of data.
Wed Jun 26 13:09:23 CEST 2013: 64 bytes from zrh04s05-in-f24.1e100.net (173.194.40.56): icmp_req=1 ttl=57 time=7.26 ms
Wed Jun 26 13:09:24 CEST 2013: 64 bytes from zrh04s05-in-f24.1e100.net (173.194.40.56): icmp_req=2 ttl=57 time=8.14 ms