How to install nano text editor on Ubuntu 22.04

Endrit Qerreti

Endrit Qerreti

nano is a command line text editor that you can use to edit or create text files.

You can also edit your existing text files, this is also done from your terminal directly.

To install nano on Ubuntu 22.04, is very simple, and you can do so by using your terminal.

The package nano is available on main repository, which means you can download nano text editor on your Ubuntu 22.04 machine without having to add any repository manually.

In this tutorial, you will learn how to install nano text editor on Ubuntu 22.04.

Step 1 - Update system

Before installing nano text editor on your Ubuntu machine, proceed to check for updates with apt package manager.

sudo apt-get update

If packages needs to be upgraded, make sure to upgrade them using the upgrade command.

sudo apt-get upgrade

Once the upgrade process has been completed, you can now move to the next step, and install nano text editor.

Step 2 - Install nano editor

nano can be found on the repositories of the latest Ubuntu versions, which includes Ubuntu 22.04. Since this package is available to be installed without having to add an external repository, you can simply download and install nano editor via your terminal.

To install nano text editor, you can do so, by running the following command below

sudo apt-get install nano

Step 3 - Verify nano installation

Now that nano is installed on your machine, you need to check if nano was installed correctly, or if something happened during the installation process.

If nano was installed correctly, when you call the version command, you should get the version of nano on your terminal.

nano --version

If for some reason the version command, doesn't return anything on your terminal, then you may need to reinstall nano.

Create a text file using nano

To create a text file using nano, is very simple. The syntax of creating a text file on nano editor is as below

sudo nano file.txt

And then simply write your text inside the text file that you created, and save changes with CTRL + X and then confirm with Y.

Read a text file using nano

To read a text file without worrying about making changes on the file, you can use the read file option. This option allows you to input the name of the text file that you want to read.

To use this option, first you need to launch nano, launch your terminal and run the command below


Next, press CTRL + R and type of the name of the file and press enter

Alternatively, you can use the file browser option that is built-in feature on nano. The file browser allows you to easily select your text file.

You can enable the file browser option, by pressing CTRL +R first then CTRL + T. And then simply browse through directories, and select the text file.

How to uninstall nano

You can uninstall nano editor from your machine, via one single line command.

To uninstall nano editor, simply run the following

sudo apt remove nano -y


In this tutorial, you learned what nano text editor is, how to install and uninstall it on Ubuntu 22.04. We also showed how you can read and create a text file with nano editor.