How to Install Nano Text Editor in Linux

The Nano text editor is a lightweight, easy-to-use command-line editor that’s perfect for beginners and advanced users alike. Many Linux distributions come with Nano pre-installed, but if it’s not available on your system, you can install it easily. This guide will show you how to check if Nano is installed and walk you through the installation process for different Linux distributions.

Table of Contents

  1. Check if Nano is installed on Linux
  2. Installing Nano on Debian/Ubuntu-Based Systems
  3. Installing Nano on CentOS/RHEL-Based Systems
  4. Installing Nano on Fedora
  5. Installing Nano on Arch Linux
  6. Installing Nano on macOS
  7. Troubleshooting

Before installing Nano, you can verify whether it’s already available on your system. Open a terminal and type:

If Nano is installed, you’ll see an output showing the version number, like:

If the terminal does not recognize the command, Nano is not installed, and you’ll need to proceed with installation.


If you are using a Debian-based system like Ubuntu, you can install Nano with the apt-get package manager.

1. Open a terminal.
2. Run the following command:

3. You might be prompted to enter your password. This is required because the sudo command runs the installation with administrative privileges.
4. Wait for the installation process to complete.
5. After installation, you can confirm it by typing:


For CentOS, RHEL, or other Red Hat-based systems, use the yum package manager:

1. Open a terminal.
2. Run the command:

3. If prompted, type y to confirm the installation.

Once the process is complete, verify the installation by running:
nano --version


Fedora users can use the dnf package manager to install Nano:


If you are using Arch Linux or an Arch-based distribution like Manjaro, use pacman:


On macOS, Nano is often pre-installed. If it’s not, you can use Homebrew, a popular package manager:

1. First, install Homebrew if you haven’t already:

2. Then, install Nano:


Troubleshooting
  • Permission Denied: If you are editing system files, you may need administrative privileges. Use sudo before the Nano command:
    sudo nano /path/to/file
  • Command Not Found: If the installation fails or the system doesn’t recognize the Nano command, ensure your package manager is updated:
    sudo apt-get update #
  • For Debian/Ubuntu
    sudo yum update # For CentOS/RHEL