Nano text editor: my own cheatsheet
Which is the best command line text editor?
Seriously, i don't know!
In my opinion, the best choice depends by the context: undoubtedly EMACS is the most complex and comprehensive, and VIM is the right balance between features and simplicity.
But, also a simple editor such as nano could be a great tool for developers!
So, in this post i try to list the main commands for this editor, but first a little bit of story...
What is GNU nano?
GNU nano is a command line text editor for *nix systems that emulates the Pico text editor, part of the Pine email client but, unlike Pico, is licensed under the GNU General Public License (GPL).
GNU nano was first created in 1999 by Chris Allegretta, with the name TIP (TIP Isn't Pico) and implements several features that Pico lacks, including syntax highlighting, line numbers, regular expression search and replace, line-by-line scrolling, multiple buffers, indenting groups of lines, rebindable key support, and the undoing and redoing of edit changes.
The name was changed to nano on 10 January 2000 to avoid a naming conflict with the existing Unix utility tip and, in February 2001, nano became a part of the GNU Project.
Open or create the file “app.py”:
Ctrl-o Y Enter
Open a new file with a new buffer:
Switch to the next file buffer:
Switch to the previous file buffer:
Move to the beginning of the current line:
Move to the end of the current line:
Move down one page:
Move up one page:
Go to the beginning of the file:
Go to the end of the file:
Go to a line number:
Jump to matching open/close symbol:
Select a block and indent the block:
Select a block and unindent the block:
Cut, Copy and Paste
To select a block for copy or cut operation, do Alt-a again to unselect:
Copy a highlighted block to the clipboard:
Cut a highlighted block to the clipboard:
Cut from the current cursor position to the end of the current line:
Paste the contents from the clipboard at the current cursor position:
Search and Replace
Search for a string:
Repeat the last search:
Search and replace: