How to install Nano Editor on Almalinux or Rocky Linux 9/8

Nano Text Editor is a command line utility to create files. It was the first release in 1999 to replace the older Pico Editor. To make it available for everyone, Nano was published under a free & open source license, hence widely used in both Unix and Linux-based systems.

Like VIM, Nano is also a lightweight text editor but offers a user-friendly interface, so that even beginners can easily use it. As there is no graphical user interface, Nano is a good option to use not only on Desktop but even on Linux servers where CLI is used to edit scripts, configuration files, and other available text-based files.

The minimalistic interface of Nano displays only the most important information, such as the filename, line number, and cursor position. This makes it easy to navigate through text files and edit them quickly.

Furthermore, operating Nano is also easy with the help of various keyboard shortcuts. For example, to save the file after editing user can use the Ctrl+O shortcut; in a similar way Ctrl+X can be used to exit the editor; whereas to cut the current line use Ctrl+K and Ctrl+U to uncut the previously cut line.

Apart from basic editing it also supports advanced features like syntax highlighting, auto-indentation, regular expression search and replace multiple buffers, and macros. These features make it a powerful tool for editing and manipulating text files.

Let’s see the steps to install the Nano Text editor on Almalinux or Rocky Linux 9 and 8.

1. Update your Linux

Go to your command terminal of Rocky or Almalinux and run the system update command. It will apply the latest available system updates on our Linux as well as rebuild the repo cache of DNF.

sudo dnf update -y

2. Installing Nano on Almalinux or Rocky

For downloading and installing the Nano text editor, we don’t need to add any additional repository because it is a popular command package that is available to install via the system’s default repository on most of the Linux distros.

sudo dnf install nano -y
Installing Nano on Almalinux or Rocky

3. Open Nano Linux text Editor

To use the installed nano editor you can either create a new file to add the content you want or edit the existing file on your Linux system.

Simply in your Terminal type – nano followed by the name of the file you want to edit. For example, to edit a file called demo.txt, you would type:

nano demo.txt

In the same way, if you want to create a new file, type nano and then the name of the file you want to create. Example:

nano newfilename

To save your changes and exit Nano Editor, press Ctrl+X, then Y, and then Enter key.

4. Important commands or shortcuts to use Text Editor

If you are not familiar with Nano already then here are some commands to use once this Text editor is installed on your AlmaLinux or Rocky Linux.

Opening a File:

To open any existing file using the nano on Almalinux or Rocky, here is the command.

nano filename

Saving a File:

After editing or creating any file we can use a keyboard shortcut given below to save the file with changes but without closing it.

Ctrl + O

Exiting Nano Editor:

Many new users keep struggling when it comes to exiting the Nano editor properly. So, for that you can use:

Ctrl + X

Before exiting the editor, if there are unsaved changes the same will be prompted by the Nano to save before exiting.

Moving Cursor:

To select the lines on the editor or some particular text we can move the cursor using arrow keys or mouse

Editing Text:

Unlike the VIM editor, we don’t need to press the INSERT button to add some text to the file like any traditional GUI Linux text editor you can directly type or delete text from it.

Copying and Pasting Text in Nano Editor:

  • Alt + A for marking the text to be copied. You can also use the Shift+arrow keys to select the Text.
  • Alt+6 to copy marked or selected text on the Nano editor.
  • Ctrl + K for cutting the marked text.
  • Ctrl + U for pasting the cut text.

Undo and Redo Nano editor text:

  • Alt+U  for undoing the last change.
  • Alt + R for redoing the last change.

Searching and Replacing:

  • Ctrl + W for searching for a specific text in the file on Nano editor.
  • Ctrl + R for replacing a specific text in the file.


  • Ctrl + G for displaying the Nano Editor help page with a list of commands.

Exiting with Saving or Discarding Changes:

  • Ctrl + X to exit, followed by Y to save changes or N to discard changes.

These are some of the basic commands you can use in Nano Editor on Linux. It has many other advanced features, such as Indent marked regions, syntax highlighting, turning visible whitespace on/off, refreshing the screen, start/stop recording of macro, and more which one can learn from the Nano Editor’s official documentation page or using the help page within the editor.

Other Articles:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.