Networking

Linux ping command

Send diagnostic echo requests to test network reachability.

Availability: Common Linux commands; shell built-ins and external implementations may differ by distribution.中文

Syntax

ping [OPTION]... DESTINATION

Examples

Send four echo requests to the host.

ping -c 4 example.com

Send three requests through eth0 (if permitted).

ping -I eth0 -c 3 192.0.2.1

Parameters, options and clauses

Option / clauseDescription
-c COUNTStop after sending COUNT requests.
-i INTERVALWait INTERVAL seconds between requests.
-s SIZESet the number of payload bytes.
-W TIMEOUTWait TIMEOUT seconds for a response.
-I INTERFACE|ADDRESSSet the outgoing interface or source address.
-nDo not resolve addresses to hostnames.
-4 / -6Use IPv4 or IPv6 only.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory