ping

>Usage

The ping command is a simple yet powerful tool used to test the connectivity between your computer and another device or server on a network. It works by sending small test messages (called packets) to the specified address and waiting for a response. This helps you determine if a target machine, such as a website or server, is reachable and how long it takes for data to travel back and forth, known as latency.

When you run ping followed by an IP address or domain name, the command displays information on how many packets were sent, how many were received, and the time taken for each packet to make the round trip. This data helps diagnose network issues, identify slow connections, or confirm if a device is online.

>Synopsis

ping [option] [destination]

>Options

-c

The -c <count> option sets the number of packets to send, instead of continuing until stopped.

Example:

Dots

-c <count>

> ping -c 4 google.com


PING google.com (172.217.168.14): 56 data bytes
64 bytes from 172.217.168.14: icmp_seq=0 ttl=113 time=7.622 ms
64 bytes from 172.217.168.14: icmp_seq=1 ttl=113 time=11.54 ms
64 bytes from 172.217.168.14: icmp_seq=2 ttl=113 time=11.42 ms
64 bytes from 172.217.168.14: icmp_seq=3 ttl=113 time=11.78 ms

--- google.com ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 7.628/10.595/11.780/1.718 ms

-q

The -q option runs it in "quiet" mode, showing only a summary of the results instead of each individual ping reply.

Example:

Dots

-q

> ping -q -c 5 google.com


PING google.com (172.217.168.14): 56 data bytes

--- google.com ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 7.961/10.500/12.782/1.956 ms

-i

The -i <interval> option sets the time in seconds to wait between sending each packet.

Example:

Dots

-i <interval>

> ping -i 5 google.com


PING google.com (172.217.168.46): 56 data bytes
64 bytes from 172.217.168.14: icmp_seq=0 ttl=113 time=8.311 ms

The same example after 5 seconds:

Dots

-i <interval>

> ping -i 5 google.com


PING google.com (172.217.168.46): 56 data bytes
64 bytes from 172.217.168.14: icmp_seq=0 ttl=113 time=8.311 ms
64 bytes from 172.217.168.14: icmp_seq=1 ttl=113 time=13.36 ms

-s

The -s <size> option sets the size of each packet in bytes, but pay attention as there are extra bytes headers added by the network protocols.

Example:

Dots

-s <size>

> ping -s 100 google.com


PING google.com (172.217.168.14): 100 data bytes
108 bytes from 172.217.168.14: icmp_seq=0 ttl=113 time=8.11 ms

-W

The -W <timeout> option sets the maximum time in seconds to wait for each reply.

Example:

Dots

-W <timeout>

> ping -W 5 google.com


The same example within 5 seconds:

Dots

-W <timeout>

> ping -W 5 google.com


PING google.com (172.217.168.14): 56 data bytes

-t

The -t <ttl> option sets a limit on the number of steps (or "hops") the packet can take to reach its destination.

Example:

Dots

-t <ttl>

> ping -t 3 google.com


PING google.com (172.217.168.14): 56 data bytes
64 bytes from 172.217.168.14: icmp_seq=0 ttl=113 time=11.45 ms
64 bytes from 172.217.168.14: icmp_seq=1 ttl=113 time=13.30 ms
64 bytes from 172.217.168.14: icmp_seq=2 ttl=113 time=8.091 ms

--- google.com ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 8.091/10.950/13.309/2.159 ms

>Quiz

Progress: Question ? out of ?

Question Title

Page written by Thomas Zaffalon