How to Install Nano Text Editor on CentOS 8

Install Nano Text Editor on CentOS 8

In this article, we will have explained the necessary steps to install and configure the Nano Text Editor on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Nano is a popular text editor of Unix and Linux operating systems. Nano comes with many powerful features and allows you to edit and create various files on your computer or server. With Nano, we have the possibility to edit text files from the Linux terminal and thus be able to easily modify files. For this, there are a series of Linux commands that we will see below and that will help us manage Nano.

Install Nano Text Editor on CentOS 8

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo dnf install epel-release
sudo dnf update

Step 2. Install Nano Text Editor on CentOS system.

We can run this command to install Nano text editor on CentOS-based platforms:

sudo dnf install nano

How to Use Nano Text Editor

In this part, you are going to learn how to open and close files. Also, how to search and replace text. Then, we’ll show you some editing tips and other basic commands that you can use in Nano text editor:

Open an Existing File

To open an existing file, add the file name to the command. For example, if the file is called files.php, the command will be:

nano files.php

Nano Control Characters and Keys

  • The shortcut to Exit out of the Nano text editor is Ctrl+X (displayed as ^X).
  • The shortcuts to Undo action in a text is Alt+U (displayed as M-U).
  • Move forward one character: Ctrl+F (^F)
  • Move back one character: Ctrl+B (^B)
  • Move forward one word: Ctrl+Space (^Space)
  • Move back one word: Alt+Space (M-Space)
  • Move to the previous line: Ctrl+P (^P)
  • Move to the next line: Ctrl+N (^N)
  • Move to the next page: Ctrl+V (^V)
  • Move to the previous page: Ctrl+Y (^Y)
  • Move to the beginning of the line: Ctrl+A (^A)
  • Move to the end of the line: Ctrl+E (^E)

Congratulation, you have learned how to install and configure Nano Text Editor on CentOS 8. If you have any question, please leave a comment below.