The Beginner’s Guide to Using Nano Text Editor in Linux

Nano Linux

There’s no denying that, for new Linux users, using the terminal is pretty scary. Scarier still is the thought of editing files at the terminal, with editors like Vim and GNU Emacs proving to be difficult for beginners to get their head around. For example, even exiting Vim proves to be a difficult task for many.

Rather than overcomplicate matters, you can go back to basics with a simple Linux text editor: Nano. It has a lot of fans, thanks to the simplicity of its interface, the powerful keyboard shortcuts it includes, and popular features like searching and line numbering. This guide shows  how to use it.

Opening Nano on Linux

Nano is pre-installed on most Linux distributions, so you shouldn’t need to install it. To run Nano, open a terminal and type simply:

This will open an empty file for you to begin writing to.

Nano Window

If you want to open a file, type:

Replace “/folder/filename” with the location of the file you’re looking to edit.

Nano Window Opened File

You can also do this with a file that doesn’t technically exist. Nano will create an empty file with that filename in the location you’ve provided.

Nano also allows you to open a file at a specific line or column. To do so, type the following:

Replace “line-number” and “column-number” with appropriate line and column numbers and “filename” with the filename for your text file. For instance:

Nano will open your chosen file at the location you’ve given, ready for you to begin editing.

Using Nano Keyboard Commands

As a terminal text editor, you can’t use your mouse to navigate the Nano app. You’ll need to use keyboard shortcuts to be able to open, save and close files at will.

Nano Shortcuts

Some of these are listed continuously at the bottom of the Nano window, but for reference, here are some of the more common commands you can use.

  • Ctrl + G: Opens the Nano help menu.
  • Ctrl + O: Saves your open file. Nano will ask you to confirm the file name when doing this, so just press Enter to confirm.
  • Ctrl + C: Cancels any pending command.
  • Ctrl + X: Exits Nano. This will also prompt you whether you want to save the file if you’ve made any changes to it. Press Enter to confirm if you do.
  • Ctrl + W: Opens a search box. Type and enter into this to locate certain text.
  • Ctrl + K: Deletes the current line of text.
  • Ctrl + _ (underscore): Moves to a certain line number. Type the line number in and press the enter button to confirm.
  • Ctrl + \ (backslash): Find and replace text. Type the text you’re looking to replace, then press Enter.

There are other commands you can try, which you can learn more about from the Nano help menu (Ctrl + G). One of the most useful additional nano commands is to check the spelling in your text. This requires you to install an extra package, so if you’re on a Debian or Ubuntu-based Linux distribution, open a terminal and type:

Once installed, open Nano and press Ctrl + T. This will begin spellchecking your document.

Nano Spell Check

If it locates any text it believes is incorrect, it will prompt you to edit it. Make the change, then press Enter to save the change.

Editing Files from the Linux Terminal

Nano is simple, and once you’ve started using it, pretty easy to get your head around. While more advanced text editors offer better features, Nano stays true to what it does best – editing files with no fuss and no problem.

If you’ve outgrown Nano and are looking for a better alternative, you could try some of the best Linux text editors like Atom instead.

Ben Stockton Ben Stockton

Ben is a UK based tech writer with a passion for gadgets, gaming, and general geekiness.


  1. I don’t understand…

    I readily admit that I am not a Linux guru but I fail to understand why one would use Nano which is –to say the least!– primitive as compared to something like LibreOffice Writer.

    1. One WOULD use a word processor or at least KWrite, Kate, Leafpad, Featherpad or any of a dozen other GUI editors. But the illusion must be maintained that one is not considered a REAL Linux user, and a member of the nerd club, unless one uses esoteric and byzantine CLI applications on a regular basis.

      Having said that, CLI text editors DO have their use for SysAdmin work.

  2. One would use a TEXT FILE editor specifically to QUICKLY edit a text file to change/modify or add text to an existing file. Like when writing code files or modifying configuration files. When using a text editor for a long time memory muscle becomes habit with out a second thought. “VI” or “VIM” editors are useful because I never lift my hands off from the keyboard reaching for a mouse. Every command is underneath my finger tips. “EMACS” is useful for same ease to quickly load and edit a text file. I don’t need to change size or type in a text editor. Or set paragraph style or insert an image. Text is just text only. In late 70s 80s amazing to use a dot matrix printer to get text printed on paper.

    “E3” is another small text editor for Linux.

    I love and use LibreOffice for editing Documents and export to PDF files for email and sharing on websites. I create business cards using templates in LibreOffice. Great tool to have available.

Comments are closed.