What is Nano Text Editor?
Nano is a text editor for Unix-like systems or any other environments
using a command line interface. It emulates the Pico text editor, a part of
the Pine email client, which also provides additional functionality. In
contrast to Pico, Nano is licensed under the GNU General Public License
(GPL).
Running Nano
Nano follows the path and opens the file if it exists. However, If it does
not exist, it’ll start a new buffer with that filename in a directory. To run
Nano Text editor, use the following command –
To run Nano Text editor, use the following command –
$ nano text_files/testfile
The output should be like this −
Shortcuts of Nano Text Editor
Nano text editor “commands” are commonly referred to as “shortcuts”
such as read file, save file, close file etc. The most common commands
are placed at the bottom of the screen, but there are many more. Note
that, nano text editor does not use the Shiftkey. All shortcuts use
lowercase letters and unmodified number keys.
To see a list of valid shortcuts hit Ctrl+G (in your Keyboard), the output
should be like this –
When you’re done looking at shortcuts, hit the CTRL+X to exit the help
window.
Suppose, if you’re working on a new text file and you want to save it,
then call it as “writing out”(Ctrl+O). The output window should be like
this –
To move the cursor forward or backward, you can
hit Ctrl+F and Ctrl+B respectively.
To move up and down one line at a time, then you can hit Ctrl+P and Ctrl+N. In
other words, you can use Right, Left, Up, and Down arrow keys (in your
keyboard) respectively.
If you want to mark any text hit CTRL+^ shortcut key.
The output window should be like this-
In the above image, we have marked “their drawing rooms.”
To cut the marked text hit Ctrl+K shortcut.
If you want to paste your marked text, hit Ctrl+U shortcut.
Frequently Used Shortcuts
The below are a list of shortcuts which can ease your work –
Command Action
CTRL + A Move to beginning of line
CTRL + E Move to end of line
CTRL + Y Move down a page
CTRL + V Move up a page
CTRL + _ Move to a specific line
CTRL + C Find out what line the cursor is currently on
CTRL + V Move up a page
CTRL + W Search for some text
CTRL + D Delete the character currently under the cursor
CTRL + K Delete entire line
CTRL + \ Replace a string of character
CTRL + O Save the content without exiting
CTRL + T When saving a file opens a browser that allows you to select a file name from a list
files and directories