When working on the command line, quite often you will need to create or edit text files or any kind of file to edit. Two of the most powerful and popular command-line editors are Vim and Emacs. Both of them have a steep learning curve that can be intimidating to new users. For those who need a simple editor, there is nano.
GNU nano is an easy to use command line text editor for Unix and Linux operating systems. It includes all the basic functionality you’d expect from a regular text editor, like syntax highlighting, multiple buffers, search and replace with regular expression support and more.
What is GNU Nano Editor
How to install GNU Nano Text Editor
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
Here is some basic nano commands might help you while editing file:
- CTRL + A :Jump to the beginning of the line.
- CTRL + E :Jump to the end of the line.
- CTRL + V :Scroll page up.
- CTRL + Y :Scroll page down.
- CTRL + W :Search for a specified phrase in your text. To search for the same phrase again press ALT + W.
- CTRL + K :Cuts the entire selected line to the “cut buffer”.
- CTRL + U :Pastes the text from the “cut buffer – Memory” into the selected line.
- CTRL + J :Justifies the paragraph.
- CTRL + _ :Go to specified line and column number.
- CTRL + C : See where your cursor currently is.
- CTRL + X :Exits Nano text editor. In case you made any changes to the file, it will prompt a save request.