Nano is a text editor for the console. It is used in Unix-like operating systems.

Installing nano editor

Since nano editor is included in the standard repositories of all popular Linux distributions, it can be installed with a single command:


yum install nano  

Debian, Ubuntu:

apt-get install nano  

nano interface and hotkeys

1) Top line - shows the version of the editor, the file being edited and if any changes have been made.

2) Editing area

3) Status bar - displays information messages.

4) At the bottom of the window the key combinations of the main editing functions are shown (symbol "^" - single press Ctrl or double - Esc):

Key combination:

  • Ctrl+G or F1 - Show Help
  • Ctrl+X or F2 - Quit nano
  • Ctrl+O or F3 - Save your changes
  • Ctrl+J or F4 - Align current paragraph (paragraphs are separated by a blank line)
  • Ctrl+R or F5 - Add contents of another file to the current one
  • Ctrl+W or F6 - Search through the file
  • Ctrl+Y or F7 - Page forward
  • Ctrl+V or F8 - Page backward
  • Ctrl+K or F9 - Cut current line and save it
  • Ctrl+U or F10 - Paste
  • Ctrl+C or F11 - Cursor position
  • Ctrl+T or F12 - Check spelling

Options for working with nano

File opens with the command:

nano filename  

or with additional options:

nano -Option1 Option2 ... OptionN + row,column file_name  

A list of all options can be found in the help:

nano -h  

Options that may be useful when starting with nano:

Options and Value:

  • -h, -? - Show this information
  • +row, column - Start at specified line and position
  • -S - Line-by-line scrolling instead of half-scrolling
  • -c - Line-by-line scrolling instead of half-scrolling
  • -i - Indent newlines automatically
  • -u - Enable Undo feature (Alt-U - undo, Alt-E - redo.)
  • -v - Viewing mode
  • -w - Don't move long lines
  • -x - Do not show two lines of help at the bottom
  • -B - Keep backup copies of existing files

Actions when editing in nano

The simplest actions that are available during editing (the Meta (m) symbol can be replaced withEsc):

Key combination:

  • Alt+A - Start text selection
  • Ctrl+K - Cut selected text
  • Alt+6 - Copy selected text
  • Ctrl+U - Paste from clipboard
  • ** m+\ ** - To the first line of the file
  • m+/ - To the last line of the file
  • Ctrl+_ or m+G - Move to a specified line number and row ([line], [row] - are specified in the message that appears)
  • m+W - Repeat last search
  • m+6 - Copies the current line and saves it on the clipboard
  • m+} - Increase line indent
  • m+{ - Decrease line indent
  • Home - To the beginning of the current line
  • End - To the end of the current line
  • m+9 - To the beginning of the current paragraph; then the next paragraph
  • m+0 - End of current paragraph; then next paragraph
  • m+T - Cut from the current position to the end of the file
  • m+J - Align entire file
  • m+D - Count words, lines and characters
  • m+Y - Enable/disable syntax highlighting
Updated Sept. 19, 2018