Show Menu

nano Keyboard Shortcuts by

How to get the most out of your nano


set afterends
Make Ctrl+Right and Ctrl+D­elete stop at word ends instead of beginnings
set autoindent
Automa­tically indent a newly created line to the same number of tabs and/or spaces as the previous line (or as the next line if the previous line is the beginning of a paragr­aph).
set consta­ntshow
Constantly display the cursor position in the status bar.
set cutfro­mcursor
Use cut-fr­om-­cur­sor­-to­-en­d-o­f-line by default, instead of cutting the whole line
set guides­tripe number
Draw a vertical stripe at the given column, to help judge the width of the text.
set stripe­color [bold,­][i­talic,]fgcolo­r,b­gcolor
Use this color combin­ation for the vertical guiding stripe
set keycolor [bold,­][i­talic,]fgcolo­r,b­gcolor
Use this color combin­ation for the shortcut key combos in the two help lines at the bottom of the screen
set linenu­mbers
play line numbers to the left of the text area.
set number­color [bold,­][i­talic,]fgcolo­r,b­gcolor
Use this color combin­ation for line numbers
set mouse
Enable mouse support, if available for your system
set nohelp
Don’t display the two help lines at the bottom of the screen
set saveonexit
Save a changed buffer automa­tically
set scroll­ercolor fgcolo­r,b­gcolor
Use this color combin­ation for the indicator alias "­scr­ollbar
set select­edcolor [bold,­][i­talic,]fgcolo­r,b­gcolor
Use this color combin­ation for selected text.
set speller "program [argument ...]"
Use the given program to do spell checking and correcting
set stateflags
Use the top-right corner of the screen for showing some state flags
set status­color [bold,­][i­talic,]fgcolo­r,b­gcolor
Use this color combin­ation for the status bar
set tabsize number
Use a tab size of number columns
set titlecolor [bold,­][i­talic,]fgcolo­r,b­gcolor
Use this color combin­ation for the title bar

Extra Info

Editing the ~/.nanorc file will enable changes to your nano when you open it.

Statef­lags: I when auto-i­nde­nting, M when the mark is on, L when hard-w­rapping (breaking long lines), R when recording a macro, and S when soft-w­rapping

Valid names for the foreground and background colours are: red, green, blue, magenta, yellow, cyan, white, and black. Each of these eight names may be prefixed with the word light to get a brighter version of that colour. The word grey or gray may be used as a synonym for lightb­lack. On a Linux console, light does not have any effect for a background colour. On terminal emulators that can do at least 256 colours, other valid (but unpref­ixable) colour names are: pink, purple, mauve, lagoon, mint, lime, peach, orange, latte, rosy, beet, plum, sea, sky, slate, teal, sage, brown, ocher, sand, tawny, brick, crimson, and normal -- where normal means the default foreground or background colour. On such emulators, the colour may also be specified as a three-­digit hexade­cimal number prefixed with #, with the digits repres­enting the amounts of red, green, and blue, respec­tively. This tells nano to select from the available palette the colour that approx­imates the given values.

Most Used

Ctrl-G (F1)
Display the help text
Ctrl-O (F3)
Write the current file to disk
Ctrl-X (F2)
Close the current file buffer / Exit from nano
Ctrl-R (F5)
Insert another file into the current one
Refresh (redraw) the current screen
Ctrl-Y (F7)
Go to previous screen
Ctrl-V (F8)
Go to next screen

Editing Text

Insert a tab at the cursor position
Insert a newline at the cursor position
Insert the next keystroke verbatim
Delete the character under the cursor
Delete the character to the left of the cursor
Cut from the cursor position to the end of the file
Count the number of words, lines, and characters
Suspend the editor (if suspend is enabled)

Search and replace

Ctrl-W (F6)
Search for a string or a regular expression
Ctrl-\ (F14) (Esc-R)
Replace a string or a regular expression
Esc-W (F16)
Repeat last search


Help mode enable­/di­sable
Constant cursor position display enable­/di­sable
Use of one more line for editing enable­/di­sable
Smooth scrolling enable­/di­sable
Whitespace display enable­/di­sable
Colour syntax highli­ghting enable­/di­sable
Smart home key enable­/di­sable
Auto indent enable­/di­sable
Cut to end enable­/di­sable
Long line wrapping enable­/di­sable
Conversion of typed tabs to spaces enable­/di­sable
Backup files enable­/di­sable
Multiple file buffers enable­/di­sable
Mouse support enable­/di­sable
No conversion from DOS/Mac format enable­/di­sable
Suspension enable­/di­sable
Soft line wrapping enable­/di­sable

Copy and Paste

Ctrl-K (F9)
Cut the current line and store it in the cut buffer
Ctrl-U (F10)
Uncut from the cut buffer into the current line
Esc-Ctrl- (Esc-6)
Copy the current line and store it in the cut buffer
Esc-\\< (Esc-,)
Switch to the previous file buffer
Esc-> (Esc-.)
Switch to the next file buffer

Moving Around

Go forward one character
Go back one character
Go back one word
Go to previous line
Go to next line
Go to beginning of current line
Go to end of current line
Ctrl-C (F11)
Display the position of the cursor
Esc-( (Esc-9)
Go to beginning of paragraph; then of previous paragraph
Esc-) (Esc-0)
Go just beyond end of paragraph; then of next paragraph
Go to the matching bracket
Esc-\ (Esc-|)
Go to the first line of the file
Esc-/ (Esc-?)
Go to the last line of the file
Ctrl-_ (F13) (Esc-G)
Go to line and column number
Esc– (Esc-_)
Scroll up one line without scrolling the cursor
Esc-+ (Esc-=)
Scroll down one line without scrolling the cursor
Ctrl-Ctrl- (F15) (Esc-A)
Mark text at the cursor position


Indent the current line
Un-indent the current line
Ctrl-J (F4)
Justify the current paragraph
Justify the entire file


Ctrl-T (F12)
Invoke the spell checker, if available


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Linux Command Line Cheat Sheet
          nano text editor Cheat Sheet
          Nano Editor Keyboard Shortcuts