Installing and Using Nano Text Editor

GNU Nano Text Editor

In this tutorial, we will install Nano and review basic commands for navigating the text editor.

Table of Contents


For the newbie Linux user, text editors like Vim or Emacs can be intimidating and present a steep learning curve. GNU Nano text editor bridges that technical gap. It was initially released 22 years ago (as of the date of this publication), in November of 1999 and written in the C language by Chris Allegretta. Nano comes installed with most Linux and Debian-based distributions and uses the command-line interface (CLI).

Pre-Installation Checks

Before we begin, this tutorial assumes you already have a Linux or Debian-based distribution (Red Hat, CentOS, Fedora, Ubuntu, etc) installed and running with access to a user with root sudo privileges. To check if nano is already installed on your machine, run the following command to display the running version on your terminal.

					[admin@vm1 ~]$ nano --version

If you have nano installed, you should see something similar to the output below. Proceed to the Navigating the Text Editor section. If not, you will receive a command not found error and in that case, proceed to the Installing GNU Nano section

					GNU nano version 2.3.1 (compiled 04:47:52, Jun 10 2014)
(C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009 Free Software Foundation, Inc.
Email: Web:
Compiled options: --enable-color --enable-extra --enable-multibuffer --enable-nanorc --enable-utf8

Installing GNU Nano

Depending on the distribution, the command for installing GNU Nano will vary.

On Red Hat7 or CentOS7

Install Nano using the yellowdog updater modified or yum command (below):

					[admin@vm1 ~]$ sudo yum -y install nano

On Red Hat8, CentOS8, or Fedora

Version 8 Linux distributions default to using dandified yum or the dnf command. NOTE: yum is a symbolic (sym) link to dnf so the yum command will work for installs on the version 8 Linux distributions–you’re actually running dnf either way.

					[admin@vm1 ~]$ sudo dnf install nano -y

On Ubuntu

Debian-based distributions and specifically the most popular among them, Ubuntu, use the advanced package tool or apt command for installs

					[admin@vm1 ~]$ sudo apt install nano -y

Navigating the Text Editor

Once GNU nano is installed, you can launch it by issuing the nano  or nano + the filename you want to create or edit

					$ nano testfile

Photo by admingeek from Infotechys

Reviewing Basic Commands

Before we proceed with some basic command examples, let’s review the options at the bottom of the screen (above). First, the ^ caret symbol represents the Ctrl key so, ^X represents the Ctrl + X key–which exits the nano text editor.



^ J or Ctrl + J  Justifies or re-wraps text when editing to prevent sentences from being too long or short.
Ctrl + O This command saves the current file. It opens the write-out menu at the bottom of the screen, where you can confirm the file name and location, and then save the changes made to the file.
Ctrl + X This command exits the nano editor. If there are unsaved changes, it will prompt you to save or discard the changes before exiting.
Ctrl + W This command searches for a string or pattern in the file. It opens the search menu at the bottom of the screen, where you can enter the search term and navigate to the next occurrence of the term by pressing Ctrl + W again.
Ctrl + K This command cuts the current line or selected text. It removes the line or text and stores it in the nano clipboard, which can be pasted using the Ctrl + U command.


These are just a few of the many commands available in the nano text editor. To see a list of all the available commands, you can press Ctrl + G to open the help menu. From there, you can browse the available commands, or search for a specific command using the Ctrl + W command described above.

We have successfully reviewed the GNU Nano install along with basic commands for navigating this text editor. Was this article helpful to you? If so, leave us a comment. We’d love to hear from you!

Leave a Reply

Your email address will not be published. Required fields are marked *