Cheat Sheet Library

Nano Cheat Sheet

A simple terminal text editor. You can type straight away. In the help bar, ^ means Ctrl and M- means Alt (or Esc).

  • 30 entries
  • 7 sections
  • Updated
  • Click a command to see all its options

30 entries

On this page

Basics #

ShortcutAction
Open or create a file
Edit a system file
Ctrl + SSave
Ctrl + O, EnterSave as ("Write Out")
Ctrl + XExit (asks to save if there are changes)
Ctrl + GHelp
Ctrl + CShow the cursor position (line/column)

Moving #

ShortcutAction
Ctrl + A / Ctrl + EStart / end of line
Ctrl + Y / Ctrl + VPage up / page down
Alt + \ / Alt + /Start / end of the file
Ctrl + _Go to a line number
Ctrl + ←/→Word left / right

Editing #

ShortcutAction
Ctrl + KCut the current line (or the selection)
Alt + 6Copy the current line (or the selection)
Ctrl + UPaste
Alt + AStart selecting (set mark), then move with the arrows
Alt + U / Alt + EUndo / redo
Alt + 3Comment / uncomment the line
Tab / Shift + TabIndent / unindent the selection
Ctrl + JJustify the paragraph
Ctrl + RInsert another file here

Search & Replace #

ShortcutAction
Ctrl + WSearch
Alt + WFind next
Alt + QFind previous
Ctrl + \Search and replace

Options #

Shortcut / flagAction
Alt + NToggle line numbers
Alt + PShow whitespace
Open with line numbers
Open at line 25
Enable mouse support

~/.nanorc #

set linenumbers
set mouse
set autoindent
set tabsize 4
set tabstospaces
set softwrap
include "/usr/share/nano/*.nanorc"   # syntax highlighting

Tips #

  • Make nano the default editor (for git commit, crontab -e…): export EDITOR=nano in ~/.bashrc.
  • Git only: git config --global core.editor nano.