1 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
Home
Free eBook
Start Here
Contact
About
Like
75
Tweet
10
If you are thinking ping is such a simple command and why do I need 15 examples, you should read the rest of
the article.
Ping command provides lot more options than what you might already know.
11/13/2013 2:07 PM
2 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
(Promoo Hoje)
Claro TV
ClaroTvPorAssinatura.tv.br/ClaroTV
(Quarta-Feira 13/11). 126 Canais
+ Telecine Grtis 90dias +Adeso
Zero
# ping -i 0.1 IP
Note: Only super user can specify interval less than 0.2 seconds. If not, youll get the following error message.
$ ping -i 0.1 127.0.0.1
PING 0 (127.0.0.1) 56(84) bytes of data.
ping: cannot flood; minimal interval, allowed for user, is 200ms
Ping Example 2. Check whether the local network interface is up and running
Before checking whether the peer machine is reachable, first check whether the local network network is up and
running using any one of the following 3 methods.
Ping localhost using zero (0)
This is probably the easiest and simplest way to ping a local host
$ ping 0
PING 0 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.024 ms
^C
11/13/2013 2:07 PM
3 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
To quit the ping command, send SIGINT signal by pressing CTRL+C. If you have not specified any option to
make the ping to exit automatically, then you will be terminating using CTRL+C ( SIGINT ) which will show the
statistics and then terminate the ping process. When everything is working properly, it should say 0% packet
loss
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.051/0.053/0.055/0.002 ms
ttl=44
ttl=44
ttl=44
ttl=44
ttl=44
time=731 ms
time=777 ms
time=838 ms
time=976 ms
time=1071 ms
--- google.com ping statistics --5 packets transmitted, 5 received, 0% packet loss, time 4216ms
rtt min/avg/max/mdev = 731.039/879.129/1071.050/126.625 ms
Ping Example 6. Audible ping: Give beep when the peer is reachable
11/13/2013 2:07 PM
4 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
This option is useful for sysadmin during troubleshooting. There is no need for you to look at the ping output
after each and every change. You can continue working with your changes, and when the remote machine
become reachable youll hear the beep automatically.
$ ping -a IP
Note: It can give beep only from terminal number 1 through 7 and gnome-terminal ( It will not work in console ).
time=0.022 ms
time=0.021 ms
time=0.020 ms
1998ms
11/13/2013 2:07 PM
5 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
Ping -w option specifies the deadline to terminate the ping output. This specifies the total number of seconds the
ping command should send packets to the remote host.
The following example will ping for 5 seconds. i.e ping command will exit after 5 seconds irrespective of how
many packets are sent or received.
$ ping -w 5 localhost
Note: When you specify both -w, and -c, whichever comes first will terminate the ping command.
ms
ms
ms
ms
ms
ms
ms
ms
ms
ms
ms
11/13/2013 2:07 PM
6 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
Ping Example 14. Specify path for ping to send the packet
You can also specify through which path the ping should send the packet to destination.
$ ping hop1 hop2 hop3 .. hopN destination
$ ping 192.168.3.33 192.168.7.1 192.168.4.45
Note: If one of the hop in the path is not reachable then you will have failure in pinging.
Ping Example 15. Record and print route of how ECHO_REQUEST sent and
ECHO_REPLY received
It records, and prints the network route through which the packet is sent and received. This is useful for network
engineers who wish to know how the packet is sent and received.
$ ping -R 192.168.1.63
PING 192.168.1.63 (192.168.1.63) 56(84) bytes of data.
64 bytes from 192.168.1.63: icmp_seq=1 ttl=61 time=2.05 ms
RR:
192.168.9.118
192.168.3.25
192.168.10.35
192.168.1.26
192.168.1.63
192.168.1.63
192.168.10.4
192.168.3.10
192.168.4.25
64 bytes from 192.168.1.63: icmp_seq=2 ttl=61 time=2.00 ms
16
Tweet
10
Like
75
(same route)
Linux provides several powerful administrative tools and utilities which will help
you to manage your systems effectively. If you dont know what these tools are and how to use them, you could
be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help
you understand system administration tools, which will help you to become an effective Linux system
administrator.
Get the Linux Sysadmin Course Now!
11/13/2013 2:07 PM
7 of 13
Examples)
3. Top 25 Best Linux Performance Monitoring and
Debugging Tools
4. Mommy, I found it! 15 Practical Linux Find
Command Examples
5. Linux 101 Hacks 2nd Edition eBook
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
Tags: Linux Ping Command, Ping -t, Ping Command, Ping Examples, Unix Ping Command
{ 22 comments read them below or add one }
1 Salih November 30, 2009 at 7:21 pm
Hi Ramesh,
Good Article. Thanks
Best Regards
Salih KM
2 Anonymous December 1, 2009 at 10:26 am
very good tutorial
3 diptanu paul December 2, 2009 at 11:54 pm
Excellent article Ramesh.Thanks for the increasing the kowledgebase.
4 S.RAGHU December 3, 2009 at 3:13 am
Great article.Never knew ping could be used to determine the ip or route and also get the short stat. Thanx
5 Sravan Babu December 5, 2009 at 12:53 am
Hi RameshAwesome tut on ping
but I m unable
to use the audible option
When I use ping -a google.com
I m not able to hear any beep
11/13/2013 2:07 PM
8 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
11/13/2013 2:07 PM
9 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
TQ
9 Anonymous March 23, 2011 at 5:12 am
superb article
10 saikrishna July 18, 2011 at 4:09 am
super article
11 TK Nallappan August 6, 2011 at 4:36 pm
Hi All,
Here is the command to protect yourself from a form of attack known as a ping flood
# sysctl -w net.ipv4.icmp_echoreply_rate=10
12 Greg Janssen October 27, 2011 at 12:38 pm
This must not be about Windows XP! Parts of it do not work with XP. Can the Increase Decrease Time
Internal of Ping packets be shown for XP? Thanks.
13 angel July 8, 2012 at 10:32 pm
One of the small hive of usable articles!
14 Gaurav B August 6, 2012 at 10:51 am
One word !!! Ultimate !!!
Thanks for posting.
15 sumit September 5, 2012 at 2:04 pm
im using ubuntu 11.10, and new linux user.
ping -R isnt workingit isnt showing me the return path
16 Sean January 31, 2013 at 7:33 pm
can you tell me what the difference between Ping -R and normal ping
i notice i can always ping but Ping -R doesnt behave the same
we had some issues with mac not being able print or use afp ( we recently upgraded to mountain lion)
we narrowed it down to the bridge that connects another bridge connection which links to a gateway to the
windows 2008 server side. As soon as we disconnected the bridge connection and use Ping -R to a printer
works straight away and afp works too.. soon as we connected it back it stops working and ping -R time
out
17 kumar February 11, 2013 at 4:22 am
how to reduce ping
18 Heinz March 29, 2013 at 9:34 am
11/13/2013 2:07 PM
10 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
Hi
Nice tutorial. I get a correct address when I ping 0 but get something different when I ping localhost?
Strange
19 Anuraj August 28, 2013 at 6:10 am
Good Article
20 Anonymous October 25, 2013 at 12:58 pm
Awesome tutorial dude. learned alot.
21 Bob November 10, 2013 at 12:29 am
this article is wrong in many respects
%ping -V
ping: illegal option V
host(1) or drill(1) should be used to determine IP not ping.
there is no -w option. you mean to use -t for timeout
CTRL+| is wrong. You mean CTRL-t
ping does not support source routing
22 NetSpider November 11, 2013 at 8:29 pm
Bob, I assume youre using Mac OS X or FreeBSD?
Ive got the same error on FreeBSD:
~ ~> ping -V
ping: illegal option V
Ramesh should specify that some examples may vary on non-Linux OSes or even on some Linux versions.
A better way to determine IP is dig:
~ ~> dig +short google.com
173.194.70.101
173.194.70.139
In order to try drill I had to install /usr/ports/dns/ldns, but in my taste the dig is better.
Leave a Comment
Name
E-mail
Website
11/13/2013 2:07 PM
11 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
Previous post: Black Friday Deal: 40% Discount on Vim 101 Hacks Book
Next post: 4 Ways to Kill a Process kill, killall, pkill, xkill
RSS | Email | Twitter | Facebook | Google+
Search
Database Modeling
Tool
www.datanamic.com
COURSE
Linux Sysadmin CentOS 6 Course - Master the Tools, Configure it Right, and be Lazy
EBOOKS
Linux 101 Hacks 2nd Edition eBook - Practical Examples to Build a Strong Foundation in
Linux
Bash 101 Hacks eBook - Take Control of Your Bash Command Line and Shell Scripting
Sed and Awk 101 Hacks eBook - Enhance Your UNIX / Linux Life with Sed and Awk
Vim 101 Hacks eBook - Practical Examples for Becoming Fast and Productive in Vim Editor
Nagios Core 3 eBook - Monitor Everything, Be Proactive, and Sleep Well
POPULAR POSTS
12 Amazing and Essential Linux Books To Enrich Your Brain and Library
50 UNIX / Linux Sysadmin Tutorials
50 Most Frequently Used UNIX / Linux Commands (With Examples)
How To Be Productive and Get Things Done Using GTD
30 Things To Do When you are Bored and have a Computer
Linux Directory Structure (File System Structure) Explained with Examples
Linux Crontab: 15 Awesome Cron Job Examples
Get a Grip on the Grep! 15 Practical Grep Command Examples
Unix LS Command: 15 Practical Examples
15 Examples To Master Linux Command Line History
11/13/2013 2:07 PM
12 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
CATEGORIES
Linux Tutorials
Vim Editor
Sed Scripting
Awk Scripting
Bash Shell Scripting
Nagios Monitoring
OpenSSH
IPTables Firewall
Apache Web Server
MySQL Database
Perl Programming
Google Tutorials
Ubuntu Tutorials
PostgreSQL DB
Hello World Examples
C Programming
C++ Programming
DELL Server Tutorials
Oracle Database
VMware Tutorials
11/13/2013 2:07 PM
13 of 13
http://www.thegeekstuff.com/2009/11/ping-tutorial-13-effective-ping-co...
Support Us
Support this blog by purchasing one of my ebooks.
Bash 101 Hacks eBook
Sed and Awk 101 Hacks eBook
Vim 101 Hacks eBook
Nagios Core 3 eBook
Contact Us
Email Me : Use this Contact Form to get in touch me with your comments, questions or suggestions about
this site. You can also simply drop me a line to say hello!.
Follow us on Google+
Follow us on Twitter
Become a fan on Facebook
Copyright 20082013 Ramesh Natarajan. All rights reserved | Terms of Service
11/13/2013 2:07 PM