Although, its competitors are way more advanced in count of features and functionalities. However, many users still prefer to use Nano as their default text editor.
|Description||GNU Nano Editor|
|Root or Sudo Privileges||Maybe|
|OS Compatibility||Ubuntu, Manjaro, Fedora, etc.|
Opening the Nano Editor
To open a nano editor simply execute the following command with or without specifying the file.
You will interact with the following window when you open the Nano editor.
Now you can type your content inside this file and use the “
Ctrl+x” keyboard shortcut to save the file.
While processing, it will ask to save the modified buffer. Input “
y” for yes.
At last, it will ask you to specify the file name; type your filename with the extension and press the “enter” key.
In future if you want to open the same file than specify the path of this file to the “
nano” command as shown.
$ nano file.txt
If you modify this saved file, after typing your first new content inside this file, you will get “
*” in front of the file name.
A lot of things you can do with nano editor by using the keyboard shortcut mentioned below.
|Ctrl+S||Save current file|
|Ctrl+O||Offer to write file (“Save as”)|
|Ctrl+R||Insert a file into current one|
|Ctrl+X||Close buffer, exit from nano|
|Ctrl+K||Cut current line into cutbuffer|
|Alt+6||Copy current line into cutbuffer|
|Ctrl+U||Paste contents of cutbuffer|
|Alt+T||Cut until end of buffer|
|Ctrl+]||Complete current word|
|Alt+U||Undo last action|
|Alt+E||Redo last undone action|
Search and replace
|Ctrl+Q||Start backward search|
|Ctrl+W||Start forward search|
|Alt+Q||Find next occurrence backward|
|Alt+W||Find next occurrence forward|
|Alt+R||Start a replacing session|
|Ctrl+H||Delete character before cursor|
|Ctrl+D||Delete character under cursor|
|Alt+Bsp||Delete word to the left|
|Ctrl+Del||Delete word to the right|
|Alt+Del||Delete current line|
|Ctrl+B||One character backward|
|Ctrl+F||One character forward|
|Ctrl+←||One word backward|
|Ctrl+→||One word forward|
|Ctrl+A||To start of line|
|Ctrl+E||To end of line|
|Ctrl+P||One line up|
|Ctrl+N||One line down|
|Ctrl+↑||To previous block|
|Ctrl+↓||To next block|
|Ctrl+Y||One page up|
|Ctrl+V||One page down|
|Alt+\||To top of buffer|
|Alt+/||To end of buffer|
|Alt+G||Go to the specified line|
|Alt+]||Go to the complementary bracket|
|Alt+↑||Scroll the viewport up|
|Alt+↓||Scroll the viewport down|
|Alt+<||Switch to preceding buffer|
|Alt+>||Switch to the succeeding buffer|
|Ctrl+T||Execute some command|
|Ctrl+J||Justify paragraph or region|
|Alt+J||Justify entire buffer|
|Alt+B||Run a syntax check|
|Alt+F||Run a formatter/fixer/arranger|
|Alt+:||Start/stop recording of macro|
|Ctrl+C||Report cursor position|
|Alt+D||Report line/word/character count|
|Ctrl+G||Display help text|
|Alt+A||Turn the mark on or off|
|Tab||Indent marked region|
|Shift+Tab||Unindent marked region|
|Alt+V||Enter next keystroke verbatim|
|Alt+N||Turn line numbers on or off|
|Alt+P||Turn visible whitespace on or off|
|Alt+X||Hide or unhide the help lines|
|Ctrl+L||Refresh the screen|
I hope you understand the usage of the nano editor; if you still have a doubt, do let us know in the comment section.