Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a ping replacement that will display the system's date/time in addition to the round trip time and sequence number? I would prefer a tool that runs on Linux, but if there is a cli tool I can run on Windows that would be good too.

There is a system which users are reporting is intermittently pausing. This doesn't seem to happen at any consistent time. I haven't been able to get the reporting user to tell when it happened with enough specificity to be able to correlate the pause to any logs.

One of the techs left a ping running against the host for a day. The round trip time got pretty large at one point in time. I am trying to figure out when exactly this happens so I can narrow down which log entries I should be looking at, and possibly correlate this pause with other data I might be able to collect with performance logs, device logs and so on.

64 bytes from icmp_seq=1825 ttl=64 time=0.321 ms
64 bytes from icmp_seq=1826 ttl=64 time=0.371 ms
64 bytes from icmp_seq=1827 ttl=64 time=13937.638 ms
64 bytes from icmp_seq=1828 ttl=64 time=12937.526 ms
64 bytes from icmp_seq=1829 ttl=64 time=11937.392 ms
64 bytes from icmp_seq=1830 ttl=64 time=10937.275 ms
64 bytes from icmp_seq=1840 ttl=64 time=936.073 ms
64 bytes from icmp_seq=1841 ttl=64 time=0.410 ms
share|improve this question
up vote 10 down vote accepted

You can add timestamps using perl like this:

ping | perl -pe 'BEGIN {use POSIX;} print strftime("%Y-%m-%d %H:%M:%S ", localtime)'
share|improve this answer
That's almost too easy! :) I searched for this for almost 30 minutes with not many good results, thanks! – l0c0b0x Nov 3 '09 at 0:54

Here's a bash solution :)

$ ping localhost | while read line ; do echo -e "$(date)\t $line" ; done
Tue Nov  3 04:46:26 MSK 2009     PING localhost ( 56(84) bytes of data.
Tue Nov  3 04:46:26 MSK 2009     64 bytes from localhost ( icmp_seq=1 ttl=64 time=0.033 ms
Tue Nov  3 04:46:27 MSK 2009     64 bytes from localhost ( icmp_seq=2 ttl=64 time=0.040 ms
Tue Nov  3 04:46:28 MSK 2009     64 bytes from localhost ( icmp_seq=3 ttl=64 time=0.046 ms
Tue Nov  3 04:46:29 MSK 2009     64 bytes from localhost ( icmp_seq=4 ttl=64 time=0.046 ms

Now, let's make the date command produce a bit more nice output:

$ ping localhost | while read line ; do echo -e "$(date +%H:%I:%S)\t $line" ; done
04:04:13         PING localhost ( 56(84) bytes of data.
04:04:13         64 bytes from localhost ( icmp_seq=1 ttl=64 time=0.044 ms
04:04:14         64 bytes from localhost ( icmp_seq=2 ttl=64 time=0.039 ms
04:04:15         64 bytes from localhost ( icmp_seq=3 ttl=64 time=0.042 ms


share|improve this answer
Pedantic: I wouldn't say native because the date command is an external command, and not built in to bash. I only point it out because if you are not aware (you might be, I don't know), realizing that there are built-in and not built-in commands is important. Still a good solution though :-) – Kyle Brandt Nov 3 '09 at 15:30
Also don't need the while [ 0 ]: ping | while read line; do echo -e "$(date) $line"; done – Kyle Brandt Nov 3 '09 at 15:37
You're right, thanks! I'm just learning bash :) – kolypto Nov 3 '09 at 19:57

A "heavier" option that we use to do regular checking of latency and packet loss is Smokeping. Not only does it give you a little more information in an easier to read format, but you can also do things like HTTP and DNS checks instead of relying on ICMP. Many firewalls and routers will de-prioritize ICMP resulting in false latency measurements.


share|improve this answer
Great tool, while heavier than the scripts it also can be nice to just setup for monitoring various systems. – sparks Nov 3 '09 at 22:24

For Linux, install moreutils which will give you ts.

$ ping | ts
jan 29 14:39:51 PING ( 56(84) bytes of data.
jan 29 14:39:51 64 bytes from ( icmp_seq=1 ttl=247 time=29.8 ms
jan 29 14:39:52 64 bytes from ( icmp_seq=2 ttl=247 time=29.4 ms
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.