step-by-step guide with pictures
Save a new document in nano
1. to save press Cntr O
2. enter file name at the bottom of the editor
3. press Enter (you should see the prompt with total number of lines being saved)
4. to exit press Cntr X
Edit, save and exit existing file in nano
after editing
1. to save press Cntr O
2. check the name of the file at the bottom of the editor
3. press Enter if you want to save with existing filename (you should see the prompt with total number of lines being saved)
3a. to change the file name, at the bottom of the editor enter the new file name and press Enter
3b. press y to save the file with new name
4. to exit press Cntr X
You can enter Cntr X to exit the nano editor. In that case, you will be asked if you would wile to save the modified buffer. Press Y and Enter to exit.
Some useful nano shortcuts with mnemonics.
Cntr X = eXit
Cntr O = write Out
Cntr Y = go one screen up
Cntr V = go one screen down (v is like down arrow)
Cntr A = go to the beginning of the current line (control strafing left)
Cntr E = go to End of current line
Cntr W = search file (Where is…)
Cntr / = replace. Enter text to replace, press enter, then enter new text to replace with and press Enter again. You will see prompt with choice, press relevant button or Cntr C to exit replacement mode. You will see info of replaced occurrence. Then you enter replacement mode the second time you can choose previous entries by using up arrow key.
Alt U = Undo the last operation
Alt E = rEdo the last operation
Alt – = scroll up one line without scrolling the cursor (- we are moving up, subtracting line numbers)
Alt + = scroll down one line without scrolling the cursor (+ line numbers are getting bigger)
Alt \ = go to the first line of the file (\ is ABOVE enter => going up)
Alt / = go to the last line of the file (/ is BELOW enter => going down)