large.log does not fit on one terminal screen.
Browse it without modifying the file, with forward/backward movement and text search.
Which command is appropriate?
less is an interactive pager for terminal text. Browsing does not rewrite the source file.
Detailed explanation
less large.logCorrect. less opens the file in an interactive pager without changing it.
Correct. less opens the file in an interactive pager without changing it.
cat large.logIncorrect. cat writes the entire file at once and offers no paging or search controls.
Incorrect. cat writes the entire file at once and offers no paging or search controls.
head large.logIncorrect. head only displays a prefix and is not interactive.
Incorrect. head only displays a prefix and is not interactive.
tail large.logIncorrect. tail displays the end of a file but does not provide the requested general pager.
Incorrect. tail displays the end of a file but does not provide the requested general pager.
Try it yourself
An example you can run in a temporary verification environment.
less --version | head -n 1Expected result
lessのVersion情報(Versionは環境により異なる)Key points
- less is a pager
- Use / for forward search
- Use q to quit
Notes
- Environment: less 590以降
- 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.