List of content you will read in this article:
Nano is the most basic text editor for Linux, which is based on the command line. Vim and Emacs are two of the most powerful and widely used command-line editors. Creating and editing text files is a common task when operating on the command line. Nano is a basic editor for those who do not have command of Vim or Emacs. Many times while working with nano, you may accidentally press anything, and your text gets deleted, and you need those lines again. Undo is the best option you can use in this case. It will help you to retrieve those lines the very moment you have deleted them.
How to Undo in Nano Editor?
You can use the following shortcut keys in nano to undo or redo:
Alt + U is used to undo anything in the nano editor.
Alt + E is used to redo anything in the nano editor.
So, now we know that we can easily undo or redo anything in the nano editor using the above shortcut keys. But remember, once you save your file, you cannot undo it again and retrieve the lines back. So before saving, if you need to retrieve the lines back, use the undo option