Show the end of service.log and continue displaying new lines as they are appended.
Which command is appropriate?
tail -f follows a file after printing its end and waits for appended data, commonly until interrupted with Ctrl+C.
Detailed explanation
head -f service.logIncorrect. GNU head does not provide the requested follow behavior with -f.
Incorrect. GNU head does not provide the requested follow behavior with -f.
less -n service.logIncorrect. less -n changes line-number handling and does not start follow mode.
Incorrect. less -n changes line-number handling and does not start follow mode.
tail -f service.logCorrect. tail -f service.log continues printing appended lines.
Correct. tail -f service.log continues printing appended lines.
wc -l service.logIncorrect. wc -l counts the current lines once and exits.
Incorrect. wc -l counts the current lines once and exits.
Try it yourself
An example you can run in a temporary verification environment.
tail --help | grep -m1 -- '--follow'Expected result
--followに関するhelp行。長時間監視は開始しないKey points
- tail shows the end
- -f means follow
- Ctrl+C usually stops following
Notes
- Environment: GNU coreutils 9.x / 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.