nerdexam
LPI

010-160 · Question #18

Which of the following keys can be pressed to exit less?

The correct answer is D. q. The less pager uses single-key commands for navigation and control. Pressing q quits and returns to the shell prompt.

Finding Your Way on a Linux System

Question

Which of the following keys can be pressed to exit less?

Options

  • Ak
  • Bx
  • Ce
  • Dq
  • E!

How the community answered

(53 responses)
  • A
    4% (2)
  • C
    4% (2)
  • D
    91% (48)
  • E
    2% (1)

Why each option

The less pager uses single-key commands for navigation and control. Pressing q quits and returns to the shell prompt.

Ak

k scrolls up one line in less; it is a navigation key, not an exit command.

Bx

x is not a standard less command and produces no recognized action in the pager.

Ce

e (or Enter) scrolls forward one line in less; it does not exit the pager.

DqCorrect

In less, the q key is the standard quit command that exits the pager and returns control to the shell. This is consistent across virtually all Unix pager programs including more and man.

E!

! in less is used to execute a shell command without exiting; it spawns a subshell rather than quitting.

Concept tested: less pager keyboard commands and navigation

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

Topics

#less pager#navigation keys#text viewing

Community Discussion

No community discussion yet for this question.

Full 010-160 Practice