View large.txt one screen at a time in a terminal.
Move backward and forward and search text without modifying the file.
Which command is appropriate?
less is an interactive pager that supports screen movement, searches, and quitting without changing the file.
Detailed explanation
cat large.txtIncorrect. cat streams all content at once and provides no interactive paging.
Incorrect. cat streams all content at once and provides no interactive paging.
head large.txtIncorrect. head shows only the beginning rather than the whole file interactively.
Incorrect. head shows only the beginning rather than the whole file interactively.
less large.txtCorrect. less large.txt provides page navigation and search.
Correct. less large.txt provides page navigation and search.
nl large.txtIncorrect. nl adds line numbers but does not provide pager controls.
Incorrect. nl adds line numbers but does not provide pager controls.
Try it yourself
An example you can run in a temporary verification environment.
less --help 2>&1 | sed -n '1,2p'Expected result
lessの使用法。対話画面は開かないKey points
- less is a pager
- / searches text
- q exits
Notes
- Environment: less 6.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.