Ping results with timestamp
It's sometimes useful to debug an issue to know when a host, which responds to ping, stops responding to pings and starts again.
Unfortunately the standard Linux ping tool does not have such functionality directly, but the following one-liner will do the trick:
HOST="yahoo.com" ; ping ${HOST} | while read pong; do echo "$(date): $pong"; done
The output looks like the following:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuenZhyJudofSX72YM6ZJVvYN4hrwRHRYBtd2UoVHruLEiD0rP4barnqf94fK13n-c0jVWX4SyNiln1unnSch_bwcbzGCZbKYLWxZxvZ5mmtHeTMVAxMndbpONOh62Zhr5fnKzrx3GIB1N/s640/2020-04-16.png)
Unfortunately the standard Linux ping tool does not have such functionality directly, but the following one-liner will do the trick:
HOST="yahoo.com" ; ping ${HOST} | while read pong; do echo "$(date): $pong"; done
The output looks like the following:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhuenZhyJudofSX72YM6ZJVvYN4hrwRHRYBtd2UoVHruLEiD0rP4barnqf94fK13n-c0jVWX4SyNiln1unnSch_bwcbzGCZbKYLWxZxvZ5mmtHeTMVAxMndbpONOh62Zhr5fnKzrx3GIB1N/s640/2020-04-16.png)
Comments
Post a Comment