• Linux
  • FreeBSD
  • Networking
  • Python
  • AWS
  • WebDev
  • About Us

How to run ping with timestamps in FreeBSD and Linux

Written by
Networking Leave a Comment

If you are tracking the latency and throughput on your server, you might need to get a relaistic ping output with time stamps , so that you can do a proper comparison and all .

In FreeBSD , the below command will run a ping on every 5 seconds with timestamps , you can then write its output to file for further use.

ping -i 5 www.bbc.com | awk '/^[0-9]+ bytes from / { "date" | getline pong; close("date"); print pong":",$0; }'

The same command in Linux based operating systems .

 ping -i 5 bbc.com | while read pong; do echo "$(date): $pong"; done

© Copyright 2020.TechieNix. All Rights Reserved.