Technotes for future me

tping ping with a timestamp

tping is a bash alias. It’s ping, but with a timestamp. Instead of looking at the increased icmp_seq number you now have a timestamp. Here’s how it looks like:


09:31:55: PING ( 56(84) bytes of data.
09:31:55: 64 bytes from ( icmp_seq=30 ttl=63 time=0.399 ms
09:32:02: 64 bytes from ( icmp_seq=37 ttl=63 time=0.409 ms
09:32:03: 64 bytes from ( icmp_seq=38 ttl=63 time=0.346 ms

09:36:20: 64 bytes from ( icmp_seq=289 ttl=63 time=1.51 ms
09:36:21: 64 bytes from ( icmp_seq=290 ttl=63 time=0.474 ms
09:36:26: 64 bytes from ( icmp_seq=295 ttl=63 time=0.498 ms
09:36:27: 64 bytes from ( icmp_seq=296 ttl=63 time=0.491 ms

The host went down on 09:32 and was back up on 09:36. This was a scheduled reboot.

bashrc or zshrc function

The shell code for in your .bashrc or .zshrc file:

tping() {
    ping $@ | while read pong; do
        echo "$(date +"%T"): $pong";
alias tping=tping

Start a new shell our source .bashrc/.zshrc after you added this function.


Last updated on 6 Jun 2024
Published on 8 Jun 2020
Edit on GitHub