Diagnose 192.0.2.1 with iputils ping.
End ping five seconds after starting regardless of replies.
Which command is appropriate?
For iputils ping, -w DEADLINE limits the total runtime independently of request count and individual response waits.
Detailed explanation
ping -w 5 192.0.2.1Correct. -w 5 sets a five-second overall deadline.
Correct. -w 5 sets a five-second overall deadline.
ping -i 5 192.0.2.1Incorrect. -i sets the interval between echo requests.
Incorrect. -i sets the interval between echo requests.
ping -s 5 192.0.2.1Incorrect. -s sets the payload size.
Incorrect. -s sets the payload size.
ping -c 5 192.0.2.1Incorrect. -c 5 limits count, not elapsed time.
Incorrect. -c 5 limits count, not elapsed time.
Try it yourself
An example you can run in a temporary verification environment.
ping -h 2>&1 | grep -E -- '-w.*deadline|-W.*timeout' | head -n 2Expected result
-wがdeadline、-Wがtimeoutであることを示すhelp行Key points
- -w is the total deadline
- -W is per-response wait
- -c is request count
Notes
- Environment: iputils ping help / パケット送信なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.