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.
head large.txtIncorrect. head shows only the beginning rather than the whole file interactively.
less large.txtCorrect. less large.txt provides page navigation and search.
nl large.txtIncorrect. 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表示のみ
- Use small, disposable text streams when testing filters.
- Locale, encoding, and GNU/POSIX implementation details can affect edge cases.
Foundation review
Place the operation
less supports navigation and search without requiring the entire output to be printed at once.
Check the side effect
Use a finite test file and exit the pager explicitly after inspection.