Create a time and date-stamped ping

22 January 2016, 03:46

If you need to run a constant ping and want each ping to have the time and date attached, the following single-line command will do the trick. For what it’s worth, this’ll work on Linux and Unix too, and in fact any BASH-equipped system:

ping | while read pong; do echo "$(date): $pong"; done

It’ll keep going until you kill it via Ctrl+C (that’s Ctrl, not Cmd!).

Obviously you should replace with the address you want to ping. If just checking for internet connectivity you can ping Google’s public DNS servers – – in which case the following will do the trick nicely:

ping | while read pong; do echo "$(date): $pong"; done

Leave a comment...