Ping with Real time (Timestamp)
ping google.com | awk '/^[0-9]+ bytes from / { "date" | getline pong; close("date"); print pong":",$0; }'
You can also save the results with a txt file with simply adding > after the command
ping google.com | awk '/^[0-9]+ bytes from / { "date" | getline pong; close("date"); print pong":",$0; }' >results.txt
If you’re interested in all types of replies (unreachable, no route to host, etc), the following should work on most systems;
ping google.com | while read pong; do echo "$(date): $pong"; done
You can also save the results with a txt file with simply adding > after the command
ping google.com | while read pong; do echo "$(date): $pong"; done > results.txt
ping google.com | awk '/^[0-9]+ bytes from / { "date" | getline pong; close("date"); print pong":",$0; }'
You can also save the results with a txt file with simply adding > after the command
ping google.com | awk '/^[0-9]+ bytes from / { "date" | getline pong; close("date"); print pong":",$0; }' >results.txt
If you’re interested in all types of replies (unreachable, no route to host, etc), the following should work on most systems;
ping google.com | while read pong; do echo "$(date): $pong"; done
You can also save the results with a txt file with simply adding > after the command
ping google.com | while read pong; do echo "$(date): $pong"; done > results.txt