Nano Text Editor in Linux - GeeksforGeeks

23 Mar, 2020
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.
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
$sudo apt install nano
$yum install nano
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+wIt will ask for a word to search for.Enter the wordIt 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+tNow it will ask you to replace the incorrect wordsEnter the word to replace with thereAs soon as you will press the enter keyMy Personal Notes
arrow_drop_upSave
4. To search a word in a file. Ctrl+w is used.
Press Ctrl+wIt will ask for a word to search for.Enter the wordIt 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
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
scp command in Linux with Examples
mv command in Linux with examples
chown command in Linux with Examples
Docker - COPY Instruction
nohup Command in Linux with Examples
SED command in Linux | Set 2
Named Pipe or FIFO with example C program
uniq Command in LINUX with examples
Thread functions in C/C++
Array Basics in Shell Scripting | Set 1