Nano Text Editor

Nano Editor Installation

Because nano editor is available in many common Linux distributions’ standard repositories, it may be launched with only one simple command:

  • CentOS: yum install nano  
  • Debian, Ubuntu: apt-get install nano

Hotkeys and the Nano Interface

1) The top line displays the editor’s version, the file being revised, and whether or not modifications have been added.

2) Workspace for editing.

3) The status bar shows informational messages.

4) The fundamental combinations for the primary changing functions are displayed at the bottom of the window (symbol “^” – single press Ctrl or double – Esc).

Keyboard Shortcuts

  • Ctrl+G or F1 to display help;
  • Ctrl+X or F2  to exit nano;
  • Ctrl+O or F3 to save your changes;
  • F4 or Ctrl+J to align the current paragraph (a blank line separates paragraphs);
  • Ctrl+R or F5 to merge the content of another record into the current one;
  • Ctrl+W or F6 to search the file;
  • Ctrl+Y or F7 moves the page forward;
  • Ctrl+V or F8 moves the page backward;
  • Ctrl+K or F9  to cut and save the current line;
  • Ctrl+U or F10 to copy;
  • Ctrl+C or F11 to the cursor position;
  • Ctrl+T or F12 to spell check.

Alternatives for Dealing with Nano

The following command is used to open the file:

nano filename or with additional alternatives:

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

A complete register of all available options may be found in the help:

nano -h 

Optional parameters that may be handy when getting started with nano:

Options and Value:

  • -h, -? to display this data;
  • +row, column to begin at the given line and position;
  • -S to line-by-line scrolling rather than half-scrolling;
  • -c to line-by-line scrolling rather than half-scrolling; 
  • -i  to automatically indent newlines;
  • -u to enable Undo feature (Alt-U for undo and Alt-E for redo);
  • -v to display mode;
  • -w do not move large lines;
  • -x don’t display the bottom two queues of help; 
  • -B to keep backup duplicates of current records.

Editing in Nano: Actions to Take

The following are the simplest editing operations (the Meta (m) sign can be substituted with Esc):

Combination to remember:

  • Begin text selection with Alt+A;
  • Cut chosen text with Ctrl+K; 
  • Alt+6 to copy selected text;
  • Ctrl+U to copy and paste from clipboard;
  • m+\ moves to the file’s first line;
  • m+/ moves to the file’s final line;
  • Ctrl+_ or m+G to navigate to a specific line and row ([line], [row] – are defined in the appearing notification);
  • m+W to rerun the previous search;
  • m+6 duplicates and saves the present line to the clipboard;
  • m+} to increase line indent;
  • m+{ to reduce line indent;
  • Home to the start of the current line;
  • End takes you to the bottom of the existing line;
  • m+9 to the start of the current paragraph, followed by the following paragraph;
  • m+0 to end of the present paragraph, then on to the next paragraph;
  • m+T to cut from the existing place to the file’s end;
  • m+J to align the whole file;
  • m+D to count the number of words, lines, and characters;
  • m+Y to toggle syntax highlighting on/off.


Blog
Subscribe to our Newsletter