$linuxjunkies
>

ping(8)

Send ICMP ECHO_REQUEST packets to network hosts to check connectivity and measure latency.

UbuntuDebianFedoraArch

Synopsis

ping [OPTION]... HOST

Description

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

FlagWhat it does
-c COUNTStop after sending COUNT ECHO_REQUEST packets; useful for scripts and automated checks
-i INTERVALWait INTERVAL seconds between sending each packet (default 1); use 0.2 for faster probing
-W TIMEOUTTime in milliseconds to wait for a response; default is 10 seconds
-s PACKETSIZESpecify the number of data bytes to send; default 56 (ICMPv4) or 48 (ICMPv6)
-t TTLSet Time To Live; useful for testing routing paths and finding hops
-vVerbose output; shows ICMP packets other than ECHO_REPLY
-qQuiet output; only show summary when finished
-nNumeric output only; do not resolve hostnames to IP addresses
-4Force IPv4 (ICMPv4) even if the hostname resolves to both IPv4 and IPv6
-6Force 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.com

Test connectivity to gateway with a 2-second timeout, sending only 1 packet

ping -c 1 -W 2000 192.168.1.1

Send 10 packets to example.com and show only the summary (quiet mode)

ping -q -c 10 example.com

Rapid ping: send 20 packets every 0.2 seconds to measure network quality

ping -i 0.2 -c 20 host.local

Test MTU size by pinging with 1472-byte packets (near standard 1500-byte Ethernet limit)

ping -s 1472 -c 5 192.168.1.100

Test only the first hop (local gateway) by setting TTL to 1

ping -t 1 8.8.8.8

Related commands