Sample Header Ad - 728x90

Why does 'ping' not output a summary when redirecting output?

30 votes
3 answers
3596 views
I can ping *google.com* for several seconds and when I press Ctrl + C, a brief summary is displayed at the bottom: $ ping google.com PING google.com (74.125.131.113) 56(84) bytes of data. 64 bytes from lu-in-f113.1e100.net (74.125.131.113): icmp_seq=2 ttl=56 time=46.7 ms 64 bytes from lu-in-f113.1e100.net (74.125.131.113): icmp_seq=3 ttl=56 time=45.0 ms 64 bytes from lu-in-f113.1e100.net (74.125.131.113): icmp_seq=4 ttl=56 time=54.5 ms ^C --- google.com ping statistics --- 4 packets transmitted, 3 received, 25% packet loss, time 3009ms rtt min/avg/max/mdev = 44.965/48.719/54.524/4.163 ms However, when I do the same redirecting output to log file with tee, the summary is not displayed: $ ping google.com | tee log PING google.com (74.125.131.113) 56(84) bytes of data. 64 bytes from lu-in-f113.1e100.net (74.125.131.113): icmp_seq=1 ttl=56 time=34.1 ms 64 bytes from lu-in-f113.1e100.net (74.125.131.113): icmp_seq=2 ttl=56 time=57.0 ms 64 bytes from lu-in-f113.1e100.net (74.125.131.113): icmp_seq=3 ttl=57 time=50.9 ms ^C Can I get the summary as well when redirecting output with tee?
Asked by ks1322 (1670 rep)
Jan 22, 2022, 11:03 AM
Last activity: Jun 29, 2025, 06:11 PM