Ctrl+O (save) and Ctrl+X (exit).
In nano’s help bar, ^ means the Ctrl key and M- means the Alt (meta) key.
Open a file
The essential shortcuts
Navigation
Selecting and copying
- Move the cursor to the start of the selection.
- Press
Ctrl+^(orAlt+A) to mark the start. - Move the cursor to the end of the selection.
- Press
Alt+6to copy, orCtrl+Kto cut. - Move to where you want to paste, press
Ctrl+U.
Undo and redo
Common workflows
Save and exit
Ctrl+O- Enter (to confirm filename)
Ctrl+X
Ctrl+X, then Y, then Enter. Nano will prompt to save on the way out.
Exit without saving
Ctrl+XN(do not save)
Search for text
Ctrl+W- Type the search string, press Enter.
Alt+Wfinds the next match.
Find and replace
Ctrl+\- Type the search string, press Enter.
- Type the replacement, press Enter.
Yfor each match to replace,Ato replace all.
