Saturday, May 4, 2024
140
rated 0 times [  140] [ 0]  / answers: 1 / hits: 150289  / 1 Year ago, mon, february 20, 2023, 4:19:37

When I ping I have this display:



> ping -i 4 www.google.fr 
64 bytes from wi-in-f94.1e100.net (173.194.67.94): icmp_seq=503 ttl=46 time=45.5 ms
.......
.......
64 bytes from wi-in-f94.1e100.net (173.194.67.94): icmp_seq=508 ttl=46 time=44.9 ms
64 bytes from wi-in-f94.1e100.net (173.194.67.94): icmp_seq=509 ttl=46 time=45.1 ms


I'd like to have the time of the ping before.



Something like:



> (right functions) + ping -i 7 www.google.fr 
mardi 15 mai 2012, 10:29:06 (UTC+0200) - 64 bytes from wi-in-f94.1e100.net (173.194.67.94): icmp_seq=503 ttl=46 time=45.5 ms
.......
.......
mardi 15 mai 2012, 10:29:13 (UTC+0200) - 64 bytes from wi-in-f94.1e100.net (173.194.67.94): icmp_seq=508 ttl=46 time=44.9 ms
mardi 15 mai 2012, 10:29:20 (UTC+0200) - 64 bytes from wi-in-f94.1e100.net (173.194.67.94): icmp_seq=509 ttl=46 time=45.1 ms


How would you do this in a command line (if it's possible)?


More From » command-line

 Answers
0

Use:



ping www.google.fr | while read pong; do echo "$(date): $pong"; done


You will get the result like this:



enter image description here


[#38417] Tuesday, February 21, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zombieptu

Total Points: 490
Total Questions: 121
Total Answers: 108

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago
zombieptu questions
Sat, Feb 18, 23, 20:00, 1 Year ago
Sun, Feb 27, 22, 02:41, 2 Years ago
Sat, Oct 30, 21, 00:00, 3 Years ago
;