Linux ping Command: Test Host Reachability and Round-Trip Time
ping sends an ICMP Echo request to check whether there is a response and the round-trip time (RTT). It is the first step in checking network connectivity, but the absence of a response does not necessarily mean that the entire service is down.
What is the ping command?
The response time is the time it takes to go to the destination and return, and it varies depending on the transmission path, congestion, and priority policies. Some hosts and firewalls block or restrict ICMP. When running it with a DNS name, name resolution is also involved, so checking again with the IP address can help narrow down the cause.
Basic syntax
ping [options] destination
Installed implementations and options may vary by distribution. Check the description for the current system with man ping.
Examples
Limit on the number of responses
Send only four times and check the summary statistics.
ping -c 4 example.com
Check IPv4 route
Select the IPv4 address to check for a response.
ping -4 -c 4 example.com
Response wait time limit
Sets to avoid waiting too long for slow or blocked targets.
ping -c 4 -W 2 192.0.2.1
Reading Response Time and Loss Rate
ping checks basic reachability and round-trip time using ICMP Echo requests and replies. This is an example of checking the local loopback address twice.
ping -c 2 127.0.0.1
Example of summary output in a normal loopback environment:
2 packets transmitted, 2 received, 0% packet loss
The time= in the reply line is the round-trip time in milliseconds and varies with each run. Even if a remote target does not respond, it does not necessarily mean the server is down. ICMP may be blocked by a firewall or there may be issues along the route, so also check the service port and DNS status separately.
Main Options and Format
| Options/Format | Description |
|---|---|
-c count |
Sends only the specified number of requests and then exits. |
-4 / -6 |
Uses IPv4 or IPv6. |
-W seconds |
Specifies the wait limit for each response. |
-w seconds |
Specifies the total execution time. |
-i seconds |
Specifies the request interval. |
Precautions when using
Continuous high-frequency requests may burden the target system or network, so use only within the scope necessary for diagnostics. A 100% packet loss can be due to various causes such as ICMP blocking, DNS issues, or path failures. The actual service status should be checked separately for the specific port and protocol.
Frequently Asked Questions
If there is no response to ping, does it mean the server is down?
You cannot conclude that. Even if a firewall or policy blocks ICMP responses, web or SSH services may still be normal.
Official Documentation
The exact behavior of options and implementation differences can be found in the official documentation related to ping.









