0.8 C
New York
Friday, February 3, 2023

How to Undo & Redo in Linux Nano file Editor – Linux Shout

Not much familiar with Linux Nano file Editor, then here are some keyboard shortcuts you can use with it to work around easily such as Undo and Redo options in Nano editor. 
Nano is easy to use and simple text-based file editor. It allows you to edit files in a terminal or console, even without a graphical environment. Although the Nano has a smaller range of functions than VIM or Emacs, it is much easier and more intuitive to use. Nano is therefore particularly suitable for smaller, fast edits or for writing short scripts.
The editor supports syntax highlighting for different programming languages, undo/redo functionality, mouse support (if a graphics server is running), automatic indentation, saving files with MS-DOS or Mac line endings, and much more.
Well, many full-fledged Linux GUI desktops come with nano editor pre-installed, however, if not then we can install it with a default package manager.
For Debian or Ubuntu-based systems
Whereas for Redhat-based ones:
Once the nano editor is installed on your system, we can create a new file easily using it. Just use the given syntax.
Whereas to open an exisiting file on the system to perform changes, we can rely on Nano editor as well.
If you are editing any file and made some changes that you want to undo before saving the file then that is possible using a simple keyboard shortcut that is: Alt+U
In case Alt+U doesn’t work, you can use Esc+u
Note: Remeber you cannot use regular Ctrl+Z  keyboard shortcut to undo becuase it will exit the text editor.
How to Undo Changes in Nano Editor
Well, if you accidently undo something and want it back then Redo is an option to go with. However, to use it in Nano using a Keyboard shortcut use the combination of Alt+E.  This will get back the last deleted text on your nano editor.
If you are totally new to Nano editor then you may not know the keyboard shortcut to save the file that you either have newly created or made some changes.
To save file use Ctrl+O key combination, and then hit the Enter key.
To safely exit the Nano editor after editing the file use the keyboard shortcut combination that is – Ctlr+X. Moreover, if you have made changes to the file, you will be prompted to save or discard those changes. If you haven’t made any changes to the file, Notepad simply closes and returns you to the command line.
Nano is found on most Linux distributions and is easy to use, with the most commonly used commands displayed at the bottom of the screen. Commands in Nano are started with the Ctrl key and are usually followed by a letter. Within the NANO program, the Ctrl key at the bottom of the screen appears as an icon.
Commands in Nano
Other Articles:
How to Create a file in Ubuntu Linux using command & GUI
Install Opera Browser on Ubuntu 22.04 LTS…
List Open or closed Ports in UFW Firewall on Ubuntu
How to install WPS Office on Ubuntu 22.04…
Linux, Ubuntu



This site uses Akismet to reduce spam. Learn how your comment data is processed.
Linux Shout crafted as a part of our main portal H2S Media to publish Linux related tutorials and open source Software.


Related Articles


Please enter your comment!
Please enter your name here

Latest Articles