The ping
command (short for “Packet InterNet Groper”) is used to test connectivity to a specified IP address or hostname by sending ICMP Echo Requests. It helps diagnose network outages, latency, and routing problems.
ping destination ping 8.8.8.8 ping www.google.com
By default, ping
continues indefinitely until interrupted (e.g., with Ctrl+C).
Option | Description | Example |
---|---|---|
-c | Number of packets to send | ping -c 4 google.com |
-i | Interval between requests (in seconds) | ping -i 2 8.8.8.8 |
-W | Timeout for replies (in seconds) | ping -W 3 google.com |
-t | Set TTL (Time To Live) value | ping -t 128 192.168.1.1 |
-s | Size of each packet in bytes | ping -s 1000 google.com |
-q | Quiet output (summary only) | ping -c 4 -q 8.8.8.8 |
-D | Print timestamp with each line | ping -D -c 2 google.com |
-f | Flood ping (requires root) | sudo ping -f localhost |
-n | Do not resolve hostnames | ping -n 8.8.8.8 |
-v | Verbose output | ping -v google.com |
64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=20.3 ms
Final summary:
--- google.com ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3002ms rtt min/avg/max/mdev = 12.034/14.245/17.672/1.902 ms
ping 192.168.0.1
ping google.com
ping -c 10 8.8.8.8
sudo ping -f localhost
ping -s 1200 -c 5 www.google.com
-f
(flood) ping should be used with caution—only for trusted testingThe ping
command is an essential diagnostic tool in Linux networking. Understanding its switches, interpreting output, and knowing its limits equip users to troubleshoot and monitor networks efficiently.