Nano is a popular test editor in Linux used by many developers & system administrators. It offers many useful features Sometimes while using Nano editor, we may make a typo or some other mistake that we may want to quickly reverse. In this article, we will learn how to undo and redo changes in Nano editor in Linux.
How to Undo & Redo in Nano Editor
You can easily undo changes in Nano editor using Alt+U in Linux and Option+U key in MacOS. If you want to redo changes you can do it using Alt+R key combination in Linux and Option+E key in MacOS.
Undo Changes in Nano Editor
Nano Editor keeps track of all your changes until you exit the editor or your session ends. If you want to undo your last change, you need to enter key combination Alt+U. If you press Ctrl+Z combination, like required for other editors, you will exit the editor and come back to your terminal, and nano editor will continue to run in background.
If the above key combinations don’t work for you, try using Esc+u.
Also, if you are using an old Nano editor (v2.1.10-2.3.4) then you will need to start Nano editor with -u option. After v2.3.4 undo and redo became standard options and are readily available for use.
Redo Changes in Nano Editor
Sometimes you may want to undo an ‘undo’ command, or repeat the last task multiple times. In such cases you can simply redo the last change, using key combination Alt+E in Linux or Option+E in MacOS.
If you want to undo an undo operation, just perform a redo operation. You can also use it to repeat a task multiple times. For example, if you want to past the same line multiple times or search and repeat same text multiple times, then using redo will make your job easier.
In this article, we have learnt how to undo & redo changes in Nano Editor. They are very useful in editing documents and writing code but many beginners are unaware of these options.
How to Undo & Redo in Vim/Vi Editor
How to Set Timeout in cURL
How to Set Indentation in Vim
How to Show Progress in Rsync
How to Clean up Snap Packages