How to use the nano command line editor in Linux
This article is designed to provide a few basic instructions for using the Linux nano command line editor. While nano does not offer the power of editors such as vi or vim, it works great for day to day editing where advanced features are not required.
Install nano
CentOS, Fedora, Redhat
sudo yum install nano
Ubuntu, Debian
sudo apt-get install nano
Start nano
nano /path/to/file/filename
Basic Editing
Using the nano editor is similar to most graphical editors you have used. Use the arrow keys to navigate the file, and type text as required. You can even use the Delete and Backspace buttons.
Keyboard shortcuts
Cancel: If you accidentally enter a command, you can cancel it anytime by pressing
+ to return to the editor.
Exit: +
If you have not saved your work, you will be promted to before exiting the program.
Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
Press
to save or to exit without saving.
Save: +
To continue using the current file name, simply press
To save to a new file name, enter the new name, then press
Search: +
Enter the text you are searching for and press
To search for additional instances of the same text, simply press + again followed by
Search and Replace: + (backslash)
Type the text to search for and press .
Next type the text you are going to replace it with, then press .
Before any text is replaced, the program will highlight the next intance it finds of the text to replace and will prompt you with the following question:
Replace this instance?
Press
Press to skip and move to the next instance.
Press to replace all instances found in the file.
Comments
So empty here ... leave a comment!