ping(8)
Send ICMP ECHO_REQUEST packets to network hosts to check connectivity and measure latency.
Synopsis
ping [OPTION]... HOSTDescription
ping sends ICMP ECHO_REQUEST packets to a destination host and waits for ECHO_REPLY responses. It is used to test whether a host is reachable on an IP network and to measure round-trip time (latency) between the sender and the target.
By default, ping runs continuously until interrupted with Ctrl+C. Each successful reply shows the packet size, source/destination IP, TTL (time to live), and response time in milliseconds.
Common options
| Flag | What it does |
|---|---|
-c COUNT | Stop after sending COUNT ECHO_REQUEST packets; useful for scripts and automated checks |
-i INTERVAL | Wait INTERVAL seconds between sending each packet (default 1); use 0.2 for faster probing |
-W TIMEOUT | Time in milliseconds to wait for a response; default is 10 seconds |
-s PACKETSIZE | Specify the number of data bytes to send; default 56 (ICMPv4) or 48 (ICMPv6) |
-t TTL | Set Time To Live; useful for testing routing paths and finding hops |
-v | Verbose output; shows ICMP packets other than ECHO_REPLY |
-q | Quiet output; only show summary when finished |
-n | Numeric output only; do not resolve hostnames to IP addresses |
-4 | Force IPv4 (ICMPv4) even if the hostname resolves to both IPv4 and IPv6 |
-6 | Force IPv6 (ICMPv6) even if the hostname resolves to both IPv4 and IPv6 |
Examples
Send 4 ECHO_REQUEST packets to google.com and display results with latency
ping -c 4 google.comTest connectivity to gateway with a 2-second timeout, sending only 1 packet
ping -c 1 -W 2000 192.168.1.1Send 10 packets to example.com and show only the summary (quiet mode)
ping -q -c 10 example.comRapid ping: send 20 packets every 0.2 seconds to measure network quality
ping -i 0.2 -c 20 host.localTest MTU size by pinging with 1472-byte packets (near standard 1500-byte Ethernet limit)
ping -s 1472 -c 5 192.168.1.100Test only the first hop (local gateway) by setting TTL to 1
ping -t 1 8.8.8.8