Skip to content

nano

Shortcut keys for editing, navigating and managing text inside the Nano editor.

Move efficiently within a file using these commands.

Move to first line

Moves to the first line of the file.

LinuxWindows
ESC+\
macOS
CTRL+y

Move to last line

Moves to the last line of the file.

LinuxWindows
ESC+/
macOS
CTRL+v

Move to beginning of line

Moves the cursor to the start of the current line.

macOSLinuxWindows
CTRL+a

Move to end of line

Moves the cursor to the end of the current line.

macOSLinuxWindows
CTRL+e

Move to previous line

Moves the cursor to the previous line.

macOSLinuxWindows
CTRL+p

Move to next line

Moves the cursor to the next line.

macOSLinuxWindows
CTRL+n

Move to previous word

Moves the cursor backward one word at a time.

LinuxWindows
CTRL+←
macOS
ALT+SPACE

Move to next word

Moves the cursor forward one word at a time.

LinuxWindows
CTRL+→
macOS
CTRL+SPACE

Move to line number

Moves the cursor to a specific line number.

LinuxWindows
ESC+g
macOS
CTRL+_

Selecting Text

Commands for selecting and cutting text.

Start selecting text

Starts marking text for cut/copy operations.

LinuxWindows
ESC+a
macOS
CTRL+SHIFT+6

Copy selected text

Copies the selected text and stores it in the buffer.

LinuxWindows
ESC+6
macOS
ALT+6

Cut selected text

Cuts the selected text and stores it in the buffer.

macOSLinuxWindows
CTRL+k

Paste text

Pastes the last cut text.

macOSLinuxWindows
CTRL+u

Search and Replace

Find text and perform replacements efficiently.

Search for a word

Finds the next occurrence of a word in the file.

LinuxWindows
ESC+f
macOS
CTRL+w
type word > ENTER

Search and replace

Replaces text throughout the file.

LinuxWindows
ESC+r
macOS
CTRL+\
search term > ENTER > replacement > ENTER

Find next occurrence

Jump to the next match in the current search.

LinuxWindows
ESC+w
macOS
ALT+w

Exiting Nano

How to quit Nano safely.

Save and exit

Writes changes to file and quits.

macOSLinuxWindows
CTRL+x+y+ENTER
x=exit, y=yes

Exit without saving

Closes Nano without saving changes.

macOSLinuxWindows
CTRL+x+n
x=exit, n=no

Miscellaneous

Other useful Nano commands.

Display help

Shows Nano's help documentation.

macOSLinuxWindows
CTRL+g

Undo

Revert the most recent change.

LinuxWindows
ESC+u
macOS
ALT+u

Redo

Reapply the most recently undone change.

LinuxWindows
ESC+e
macOS
ALT+e