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.
Question
Options
- Ak
- Bx
- Ce
- Dq
- E!
How the community answered
(53 responses)- A4% (2)
- C4% (2)
- D91% (48)
- E2% (1)
Why each option
The less pager uses single-key commands for navigation and control. Pressing q quits and returns to the shell prompt.
k scrolls up one line in less; it is a navigation key, not an exit command.
x is not a standard less command and produces no recognized action in the pager.
e (or Enter) scrolls forward one line in less; it does not exit the pager.
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.
! 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
Community Discussion
No community discussion yet for this question.