While travelling it’s sometimes useful to know how your connection is doing. When nothing is loading, or connections timing out, getting a quick snapshot of the connection health will tell you how bad it is, and give you an idea of how soon you will be up and running agian.
Here’s a one-liner that works on most Unix based systems:
ping -i5 184.108.40.206 | grep --line-buffered -o -E -e "time=.*$" -e "timeout"
Here we use
ping to send an ICMP request to Google’s DNS server
220.127.116.11 every 5 seconds. By piping standard out to
grep with the
--line-buffered option we can grep the continuous output stream and, by using
-o, showing only the matches.
Here’s what it looks like:
time=602.919 ms time=604.434 ms time=1233.740 ms time=150.504 ms
To make it easier to access, we can create a small script in
touch ~/bin/travelping chmod +x ~/bin/travelping
And add the contents:
#!/bin/bash ping -i5 18.104.22.168 | grep --line-buffered -o -E -e "time=.*$" -e "timeout"
From the command line we can now run:
$ travelping time=743.092 ms time=1784.171 ms time=1430.412 ms timeout timeout time=497.880 ms
If you’re using
iTerm2, it fits neatly in one corner of your screen. Here together with