Operating Systems

A technician has opened /etc/hosts in nano over SSH and must find an entry, save the change, and close the editor. Which key combinations does nano use for these tasks? (Choose three.)

Choose 3 answers

Show the answer

Correct answersA. Ctrl+O to write out the fileB. Ctrl+W to search for textC. Ctrl+X to exit the editor

AWhy this is right: Ctrl+O is nano's Write Out command, which saves the buffer to the file.

BWhy this is right: Ctrl+W is nano's Where Is search command, so it finds text in the open file.

CWhy this is right: Ctrl+X closes nano and prompts to save any unsaved changes first.

DWhy not this: Esc then :wq is vi's command-mode save and quit; nano has no command mode and would not accept it.

EWhy not this: Ctrl+K cuts the current line in nano; saving the file is Ctrl+O.

nano shows its shortcuts at the bottom of the screen: Ctrl+W searches, Ctrl+O writes the file out, and Ctrl+X exits, prompting to save if there are unsaved changes. The :wq command belongs to vi, a modal editor, and nano does not interpret it. Ctrl+K cuts the current line rather than saving.