nerdexam
LPI

010-150 · Question #11

Which of the following commands can be used to view a file and do search operations within it while viewing the contents?

The correct answer is A. less. The less command is an interactive pager that allows viewing file contents and performing forward and backward searches within the displayed content.

Initial Client Consultation and Assessment

Question

Which of the following commands can be used to view a file and do search operations within it while viewing the contents?

Options

  • Aless
  • Bfind
  • Cgrep
  • Dreport
  • Esee

How the community answered

(37 responses)
  • A
    81% (30)
  • B
    11% (4)
  • C
    5% (2)
  • D
    3% (1)

Why each option

The `less` command is an interactive pager that allows viewing file contents and performing forward and backward searches within the displayed content.

AlessCorrect

`less` is an interactive terminal pager that displays file contents one screen at a time and supports search operations using `/` for forward search and `?` for backward search while viewing the file. Unlike editors, it opens files read-only, and unlike `more`, it allows bidirectional navigation through the content.

Bfind

`find` is used to locate files and directories within a filesystem based on criteria such as name or type, not to view or search within file contents.

Cgrep

`grep` searches for patterns within files and prints matching lines to stdout, but it does not provide an interactive viewing interface for browsing the full file.

Dreport

`report` is not a standard Linux/Unix command for viewing files.

Esee

`see` is not a standard Linux/Unix command for viewing or searching file contents.

Concept tested: Interactive file viewing and search with less

Source: https://man7.org/linux/man-pages/man1/less.1.html

Topics

#less command#file viewing#text search#Linux CLI

Community Discussion

No community discussion yet for this question.

Full 010-150 Practice