ping Cheatsheet
Basic Syntax
Core ping command forms.
| Command | Description |
|---|---|
ping host |
Continuously ping a host |
ping -c 4 host |
Send 4 echo requests, then stop |
ping -i 2 host |
Wait 2 seconds between packets |
ping -w 10 host |
Stop after 10 seconds |
ping --help |
Show available options |
Common Reachability Checks
Quick tests for DNS names and IP addresses.
| Command | Description |
|---|---|
ping google.com |
Test DNS resolution and connectivity |
ping 8.8.8.8 |
Test reachability to a public IPv4 address |
ping localhost |
Verify local TCP/IP stack |
| `ping $(hostname -I | awk ‘{print $1}’)` |
ping router.local |
Test a local network device by hostname |
Count and Timing
Control how many packets are sent and how long ping runs.
| Command | Description |
|---|---|
ping -c 3 host |
Send exactly 3 packets |
ping -c 5 -i 0.5 host |
Send 5 packets at 0.5-second intervals |
ping -w 5 host |
Stop after 5 seconds total |
ping -W 2 host |
Wait up to 2 seconds for each reply |
ping -c 10 -q host |
Show summary only after 10 packets |
IPv4 and IPv6
Force the address family when needed.
| Command | Description |
|---|---|
ping -4 host |
Use IPv4 only |
ping -6 host |
Use IPv6 only |
ping6 host |
IPv6 ping on systems that provide ping6 |
ping -c 4 -4 example.com |
Check IPv4 replies for a dual-stack host |
ping -c 4 -6 example.com |
Check IPv6 replies for a dual-stack host |
Packet Size and Interface
Adjust packet payload and source interface.
| Command | Description |
|---|---|
ping -s 1400 host |
Send larger packets with 1400-byte payload |
ping -s 56 host |
Use the default payload size explicitly |
ping -I eth0 host |
Send packets from a specific interface |
ping -I 192.168.1.10 host |
Use a specific source address |
ping -D host |
Print timestamps before each reply |
Troubleshooting
Quick checks for common ping issues.
| Issue | Check |
|---|---|
Name or service not known |
DNS failed; test with an IP address directly |
Destination Host Unreachable |
Check routing, gateway, and local network link |
| 100% packet loss | The host may be down, blocked by a firewall, or not routing replies |
ping: socket: Operation not permitted |
Use sudo or verify capabilities on systems with restricted raw sockets |
| IPv6 ping fails only | Confirm the host has AAAA records and IPv6 connectivity |
Related Guides
Use these guides for broader network troubleshooting workflows.
| Guide | Description |
|---|---|
| ping Command in Linux | Full ping guide with detailed examples |
| IP command cheatsheet | Inspect interfaces, addresses, and routes |
| ss Command in Linux | Inspect sockets and active network connections |
| traceroute Command in Linux | Trace the route packets take to a host |
| SSH cheatsheet | Quick reference for remote connectivity commands |
KI-Assistent
