How to Use Undo Functionality in Nano?

In Linux, the nano editor is a simple and powerful built-in text editor. It has features like colored text, bindable key support, searching/replacing expressions, etc. On top of that, it is the most user-friendly text editor on Linux. One of the most notable features of the Nano is “Undo”, which is used to revert the recent change. 

This writing is about using undo functionality in the nano editor of Linux.

How to Install Nano Editor on Linux?

The nano editor is pre-installed in almost all distributions of Linux. If it is not available, then it can be installed on the respective Linux distribution via the following command:

$ sudo apt install nano            #For Ubuntu/Debian
$ sudo pacman -S nano         #For Arch Linux
$ sudo yum install nano               #For CentOS/RHEL
$ sudo dnf install nano            #For Fedora

The output shows that “nano” is already installed in the system.

How to Undo in Nano on Linux?

When editing a document or a script file, you may have made an unnecessary addition/removal that must be undone. In most cases, the users will use “CTRL+Z.“ which invokes the nano editor’s suspension mechanism, and they need to type “CTRL+Z+T” to suspend the current session. It will save the changes which cannot be undone.


To Undo in the nano editor, press “CTRL+U,” and the message “Undid addition” is appeared, as seen below:

In the above image, a few words were added to the existing text, let’s delete a few words, and then do “undo functionality” of the nano editor using the combination of “ALT+U”:

It will now show the message “Undid deletion,” meaning that the characters/words that were deleted are added back to the file.

How to Redo in Nano on Linux?

It is possible that a user accidentally undid the changes and wants to redo them. The nano editor has a redo command that can bring back the changes made by undo command.


To redo in the nano editor, press “CTRL+E,” and it will display the message “Redid deletion,” confirming that the changes made by “undo functionality” are now “redone”:

The above image confirms the “redo functionality” of the nano editor on Linux.


The undo feature of the nano allows the users to fall back to the previous version of the document by reverting a few changes. It performs the undo functionality using “ALT+U” and redo functionality using “CTRL+E.”This guide illustrated the use of the nano editor and how users can perform the “undo” and “redo” functionality in it.