Here are some common Nano commands used in the Nano text editor:
-
Open/Create a File:
nano filename- Opens an existing file or creates a new file with the specified filename.
-
Save File:
Ctrl + O(WriteOut)- Saves the changes made to the current file.
-
Exit Nano:
Ctrl + X- Exits the Nano editor. If there are unsaved changes, Nano will prompt to save before exiting.
-
Cursor Movement:
- Arrow keys: Move the cursor up, down, left, or right.
-
Ctrl + F: Move cursor forward one character. -
Ctrl + B: Move cursor backward one character. -
Ctrl + P: Move cursor to the previous line. -
Ctrl + N: Move cursor to the next line. -
Ctrl + A: Move cursor to the beginning of the current line. -
Ctrl + E: Move cursor to the end of the current line. -
Ctrl + \: Move cursor to a specific line number.
-
Search and Replace:
-
Ctrl + W: Search for text. -
Alt + W: Repeat search in the opposite direction. -
Ctrl + \: Replace text.
-
-
Cut, Copy, and Paste:
-
Ctrl + K: Cut the current line. -
Ctrl + U: Paste the cut text. -
Ctrl + Shift + 6: Copy the selected text. -
Ctrl + Shift + U: Paste the copied text.
-
-
Undo and Redo:
-
Ctrl + _orCtrl + Shift + 6: Undo the last change. -
Alt + _: Redo the last undone change.
-
-
Mark Text:
-
Ctrl + ^: Start marking text. - Arrow keys: Move the cursor to select text.
-
Alt + ^: End marking text.
-
-
Other Commands:
-
Ctrl + G: Display Nano's help menu. -
Ctrl + C: Display current line and column number. -
Ctrl + R: Read another file into the current one. -
Ctrl + T: Invoke spell checker.
-
These are some of the basic Nano commands. Nano also provides many other features and functionalities, which you can explore further in its documentation or help menu (Ctrl + G).
Top comments (1)
.nanorc
set linenumbers