In this article you will learn about GNU Nano Editor, and how to install and use Nano editor.
What is GNU Nano Editor
GNU nano is one easiest and popular command line text editor used on many operating systems including Unix-based systems and BSD variants. It contains all the basic functionality you’d need from a regular text editor, like syntax highlighting, multiple buffers.
How to install GNU Nano Text Editor
Installing nano is related to OS distributions, because some OS include nano editor preinstalled.
Install GNU Nano Text Editor on Debian / Ubuntu
sudo apt-get install nano
Install Nano Text Editor on CentOS / RHEL
yum install nano
GNU Nano Text Editor Common Commands
Follow this command to edit a file named demo.txt, but if there was no file then nano editor will create a new file while saving the file.
You might need these nano commands while editing file:
- Jump to the beginning of the line: CTRL + A
- To Jump to the end of the line: CTRL + E
- Scroll page up: CTRL + V
- To Scroll page down: CTRL + Y
- Search for a specified phrase in your text: CTRL + W. To search for the same phrase again press ALT + W
- Cuts the entire selected line to the “cut buffer”: CTRL + K
- Pastes the text from the “cut buffer – Memory” into the selected line: CTRL + U
- Justifies the paragraph: CTRL + J
- Go to specified line and column number: CTRL + _
- See where your cursor currently is: CTRL + C
- Exits Nano text editor. In case you made any changes to the file, it will prompt a save request: CTRL + X