ping Command Cheat Sheet
ping (Packet Internet Groper) uses the ICMP protocol's ECHO_REQUEST to test if a host is reachable and measures the round-trip time.
Synopsis
ping [options] destination
Basic Usage
Check Connectivity
Send packets indefinitely (Linux default) until you press Ctrl+C.
ping google.com
Limit Count (-c)
Send only 5 packets and exit. (Default behavior on Windows).
ping -c 5 google.com
Performance Options
Change Interval (-i)
Wait N seconds between sending each packet (Default: 1s).
Fast ping: 0.2 seconds.
ping -i 0.2 google.com
Flood Ping (-f)
Send packets as fast as possible. Used for stress testing. Warning: Can flood the network. Requires root.
sudo ping -f google.com
Timestamp (-D)
Print timestamp (UNIX time) before each line.
ping -D google.com
Audible Ping (-a)
Beeps when a response is received. Useful when fixing a cable in another room.
ping -a google.com
Payload Options
Packet Size (-s)
Send larger packets to test MTU (Maximum Transmission Unit) issues. (Default is usually 56 bytes + 8 bytes header = 64 bytes).
# Send 1000 bytes
ping -s 1000 google.com
Do Not Fragment (-M do)
Prevent fragmentation. Combine with -s to find the PMTU (Path MTU).
ping -s 1472 -M do google.com
Troubleshooting Output
"Destination Host Unreachable"
The local system has no route to the destination (e.g., disconnected cable, bad gateway).
"Request timed out" (or simply no output)
The packet was sent, but no reply came back. - Host is down. - Firewall (host or intermediate) is blocking ICMP.
"TTL=" (Time To Live)
- Linux/Unix: Usually starts at 64.
- Windows: Usually starts at 128.
- Cisco: Usually starts at 255. You can roughly guess the OS of the remote target by the TTL.
IPv6
On modern systems, ping handles IPv6 automatically. On older systems, use ping6.
ping6 ipv6.google.com
# or
ping -6 google.com