home Tech Ping pong

Ping pong

I am being very irregular in my blog posts here.Travel and other activities like soul searching are taking most of my time.

Recently I bought a book called The Power Of Now by Eckhart Tolle which dwells on topics of spiritualism and soul searching.Good read and the author writes in a question answer format about various stuff.

Anyway,here is an extremely simple ping shell script which uses packet count as a fixed number and only one argument which is the target.I did this because ping in *nix shell generates infinite replies(like a ping -t in Windoze)and I didnt want to do a packet count on ping or a ctrl-c everytime to break the response.

avp@hellsbells:~$ cat ping
#!/bin/sh –

# Ping with 7 packets and 1 target
ping -c 7 $1

avp@hellsbells:~$chmod +r ping

avp@hellsbells:~$ ./ping timesofindia.com
PING timesofindia.com (203.199.93.69) 56(84) bytes of data.
64 bytes from www.timesofindia.indiatimes.com (203.199.93.69): icmp_seq=1 ttl=117 time=40.2 ms
64 bytes from www.timesofindia.indiatimes.com (203.199.93.69): icmp_seq=2 ttl=117 time=36.5 ms
64 bytes from www.timesofindia.indiatimes.com (203.199.93.69): icmp_seq=3 ttl=117 time=31.0 ms
64 bytes from www.timesofindia.indiatimes.com (203.199.93.69): icmp_seq=4 ttl=117 time=30.4 ms
64 bytes from www.timesofindia.indiatimes.com (203.199.93.69): icmp_seq=5 ttl=117 time=35.7 ms
64 bytes from www.timesofindia.indiatimes.com (203.199.93.69): icmp_seq=4 ttl=117 time=30.4 ms
64 bytes from www.timesofindia.indiatimes.com (203.199.93.69): icmp_seq=5 ttl=117 time=35.7 ms

— timesofindia.com ping statistics —
7 packets transmitted, 7 received, 0% packet loss, time 6001ms
rtt min/avg/max/mdev = 30.492/35.095/40.263/3.118 ms

Or if you dont want to make a script like this,simply alias ping as ping -c $1 in your profile 🙂 …

Peace.

Leave a Reply

Your email address will not be published. Required fields are marked *