Nano Key Commands
Here is a quick reference list of key commands for the GNU nano text editor.
In nano, ^ represents the Ctrl key, and Alt (or Meta, M-) is used for secondary commands.
File Handling & Basics
• Ctrl + G: Display the built-in help menu
• Ctrl + O: Save the file ("Write Out" / prompt for filename)
• Ctrl + S: Save the file directly (without prompt)
• Ctrl + R: Read/insert another file into the current buffer
• Ctrl + X: Exit nano (prompts to save if changes were made)
Cursor Movement
• Arrow keys: Move cursor one character/line
• Ctrl + A: Go to the start of the current line
• Ctrl + E: Go to the end of the current line
• Ctrl + P: Move one line up
• Ctrl + N: Move one line down • Ctrl + Y: Scroll one page up • Ctrl + V: Scroll one page down • Ctrl + _: Go to a specific line and column number • Alt + \: Go to the very top of the buffer/file • Alt + /: Go to the very bottom of the buffer/file
Editing & Text Manipulation
• Ctrl + K: Cut the current line (or selected text) • Alt + 6: Copy the current line • Alt + A: Start or cancel text selection (mark) • Ctrl + U: Paste (uncut) text from the buffer • Ctrl + J: Justify the current paragraph • Alt + U: Undo the last action • Alt + E: Redo the last undone action • Alt + 3: Comment or uncomment the current line
Deletion
• Backspace / Ctrl + H: Delete the character to the left of the cursor • Delete / Ctrl + D: Delete the character under the cursor • Alt + Backspace: Delete the word to the left • Ctrl + Delete: Delete the word to the right
Search & Replace
• Ctrl + W: Search for text (Where Is) • Alt + W: Repeat the last search • Ctrl + \: Search and replace text
Display & Toggles
• Alt + N: Toggle line numbers on or off • Alt + P: Toggle visible whitespace on or off • Alt + Y: Toggle syntax coloring on or off • Alt + S: Toggle smooth scrolling • Ctrl + L: Refresh and redraw the screen