Understanding the ping Command

Basic Usage of ping

The ping command is used to check the reachability of a host on an Internet Protocol (IP) network. It sends Internet Control Message Protocol (ICMP) Echo Request messages to the destination and listens for Echo Response replies.

ping [OPTION]... destination

Options Available with ping

-c count

Send a specific number of ping requests:

ping -c 4 example.com

-i interval

Set the interval between sending each packet (in seconds):

ping -i 2 example.com

-t ttl

Set the Time To Live for the packets:

ping -t 64 example.com

-s size

Specify the number of data bytes to be sent:

ping -s 56 example.com

-W timeout

Set the time to wait for a reply (in seconds):

ping -W 2 example.com

-q

Run in quiet mode (suppress output except for summary):

ping -q example.com

-h

Display help information for the command:

ping -h

Examples of ping Command

Ping a Host

ping example.com

This command sends an infinite number of ping requests to the specified host.

Ping a Host with a Specific Count

ping -c 5 example.com

This command sends exactly 5 ping requests to the specified host.

Ping a Host with a Custom Packet Size

ping -s 128 example.com

This command sends ping requests with 128 bytes of data.

Understanding Ping Output

The output of the ping command typically includes the following information:

Summary of Options

Option Description
-c count Send a specific number of ping requests.
-i interval Set the interval between sending each packet.
-t ttl Set the Time To Live for the packets.
-s size Specify the number of data bytes to be sent.
-W timeout Set the time to wait for a reply.
-q Run in quiet mode (suppress output except for summary).
-h Display help information for the command.