When to use ping
Use ping to test ICMP reachability and approximate round-trip timing. Limit the probe count for diagnostics and do not equate an ICMP result with the health of a particular application port.
Syntax
ping [PARAMETERS] NODESquare brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.
Common options and arguments
Usage examples
Check availability with limited requests
ping -c 4 example.comFour probes are sent and a summary reports replies, loss and timing.
Check IPv4
ping -4 -c 3 example.comThe lookup and probes are restricted to IPv4.
Check local interface
ping -c 2 127.0.0.1The loopback address tests a local networking path rather than an external route.
Notes and limitations
- Lack of response does not prove that the application is unavailable: ICMP may be blocked.
- To test a specific service, use nc or the appropriate protocol client.
Common questions and troubleshooting
Does a failed ping mean the server is offline?
Not necessarily. ICMP can be filtered or rate-limited while SSH or HTTPS still works. Test the intended application endpoint.
Does a successful ping prove SSH is working?
No. Ping does not authenticate, negotiate SSH or check a TCP listening port. Follow with an actual service-specific check.
Further help
Options vary by version and distribution. Check the installed documentation with this command: man ping.