Send exactly four ICMP echo requests to 192.0.2.1 and then exit.
Use the common iputils ping.
Which command is appropriate?
For iputils ping, -c COUNT limits the number of echo requests. -i, -s, and -W control different settings.
Detailed explanation
ping -c 4 192.0.2.1Correct. -c 4 sends four requests and then exits.
Correct. -c 4 sends four requests and then exits.
ping -i 4 192.0.2.1Incorrect. -i sets the interval between requests.
Incorrect. -i sets the interval between requests.
ping -s 4 192.0.2.1Incorrect. -s sets the payload size.
Incorrect. -s sets the payload size.
ping -W 4 192.0.2.1Incorrect. -W controls response waiting time, not request count.
Incorrect. -W controls response waiting time, not request count.
Try it yourself
An example you can run in a temporary verification environment.
ping -h 2>&1 | grep -E -- '-c.*count' | head -n 1Expected result
-c countが送信回数を指定することを示すhelp行Key points
- -c means count
- The command exits after the count
- Distinguish -i and -W
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.