Nano Text Editor in Linux
Nano is a user-friendly, simple and WYSIWYG(What You See Is What You Get) text editor, which improves the features and user-friendliness of UW Pico text editor. Unlike vim editor or any other command-line editor, it doesn’t have any mode. It has an easy GUI(Graphical User Interface) which allows users to interact directly with the text in spite of switching between the modes as in vim editor.
Installing Nano Text Editor
Nano is generally by default available in many Linux distributions but in case, it is not installed you may install the same using the following commands.
$sudo apt update
In case of Debian/Ubuntu
$sudo apt install nano
In case of CentOS/Fedora
$yum install nano
Working with Nano Text Editor
1. To create and open a new file.
$nano new_filename

The above command will open a new file with new_filename as shown in the output. In case the file already exists it will open the same and in case the file is not there in the current directory it will create a new one. At the bottom of the window, there is a list of shortcut keys for nano.
2. To save a file
press Ctrl+o
It will ask you for the filename. In case, you want to save the changes to a new file or want to create a new file then change the name else keep the name same.

As soon as you will press enter key, then In case, you have changed the name of the file then it will save the file with a new name and if not then it will save the changes to the current file.
3. To cut paste in a file. Ctrl+o is used to cut and Ctrl+u is used to paste the text.
- To cut and paste a whole line. Move to the line which you want to cut then press Ctrl+k. Now the line is moved to clipboard, To paste it, go to the position where you want to paste and then press Ctrl+u

- To cut and paste the selected text. Select the text which you want to cut then press Ctrl+k. Now the text is moved to clipboard. To paste it, go to the position where you want to paste and then press Ctrl+u.

4. To search a word in a file. Ctrl+w is used.
Press Ctrl+w
It will ask for a word to search for.
Enter the word
It will search for the word and will place the cursor in the first letter of the first occurrence of the word.

5. To enable spell check in nano. First, install the spell check package.
$sudo apt install spell
It will then ask for the password then enter the password. Then press y and then press enter.

- To do spell check first press Ctrl+t
- Now it will ask you to replace the incorrect words
- Enter the word to replace with there
- As soon as you will press the enter key

Recommended Posts:
- Encrypting Files Using vim editor in Linux
- Formatted text in Linux Terminal using Python
- vi Editor in UNIX
- Linux Virtualization : Linux Containers (lxc)
- Why Linux is Better?
- du Command in LINUX
- SED command in Linux | Set 2
- while command in Linux with example
- The Linux Kernel
- Run Levels in Linux
- Linux Commands
- who command in Linux
- Linux | Nmon
- Different Shells in Linux
- Fun Commands in Linux
- Filters in Linux
- Some useful Linux Hacks
- 10 Best Linux VPS Hosting
- Permissions in Linux
- Wikit in Linux
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


