5 ms·
Or you can do this in general: ping 8.8.8.8 | perl -ne 'BEGIN {$|=1;} s/.*=([0-9\.]+) ms$/\1/ && print'| feedgnuplot --stream --ylabel "Ping time (in ms)" --
by dima55 6y ago
Or you can do this in general:
ping 8.8.8.8 | perl -ne 'BEGIN {$|=1;} s/.*=([0-9\.]+) ms$/\1/ && print'| feedgnuplot --stream --ylabel "Ping time (in ms)" --lines
Advantage: works for ANY input, not just pings. And is infinitely more flexible. Want a histogram of your pings updating in realtime? Here you go:
ping 8.8.8.8 | perl -ne 'BEGIN {$|=1;} s/.*=([0-9\.]+) ms$/\1/ && print'| feedgnuplot --stream --histo 0 --binwidth 1
- tutfbhuf 6y agoBut therefore you need perl, gnuplot and feedgnuplot, the latter isn't even available via package manager on my distro.
- tjoff 6y agoFantastic, thanks, I think this was the final push I needed to start abusing gnuplot. Though for some reason the plot only updates when I give or take the plot window focus (refreshperiod mentioned in the man page doesn't seem to help, and I think it should default to 1Hz).
- tjoff 6y agoFix for this issue (on wayland) mentioned here: GDK_BACKEND=x11 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942570 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942570
- ktpsns 6y agoAnother great example how a couple of traditional unix tools (if you want to count perl and gnuplot as traditional unix tools) can replace 250 lines of high-level language code (https://github.com/orf/gping/blob/master/src/main.rs https://github.com/orf/gping/blob/master/src/main.rs).