nano: Text Editor for Beginners

nano: Text Editor for Beginners

Bitnesia Aug 15, 2026 7 ID

During your Linux learning journey, you will often need to edit text files, for example to change configuration files, write notes, or create scripts. Although graphical editors like GNOME Text Editor are available, there are times when you are working directly in the terminal and need a lightweight and simple editor. nano is the answer. This editor is installed by default on Ubuntu 26.04 LTS and Fedora Workstation 44, is easy to learn, and displays a list of keyboard shortcuts at the bottom of the screen so you do not need to memorise them beforehand. This chapter will guide you to master nano as your first terminal text editor.

One thing to know from the start: starting from version 8.0 (released in 2024), nano changed a number of its default shortcuts to be more beginner‑friendly, and the versions bundled in Ubuntu 26.04 LTS and Fedora Workstation 44 already use this new scheme. If at any time the display at the bottom of your nano screen differs slightly from what is written in this chapter, run nano --version to check your version, and trust the shortcut list shown on screen — that is the most accurate reference for your installation.

Why Do You Need a Text Editor in the Terminal?

When managing a Linux system, many tasks must be done inside the terminal, such as fixing broken configurations, editing system files, or writing simple scripts. In such situations, switching to a graphical application is cumbersome, especially if you are working on a server that has no graphical display at all. A terminal text editor allows you to edit files without leaving the terminal environment.

Among the many terminal text editors, nano is the most beginner‑friendly choice. Unlike vim, which has a steep learning curve, nano can be used immediately without needing to understand modes or special commands. All its important shortcuts are always displayed at the bottom of the screen, so you always know which key to press.

Opening and Creating Files with nano

To open a file with nano, run the command nano followed by the filename. If the file already exists, its contents are displayed. If it does not exist, nano will create a new file with that name.

nano notes.txt

The command above opens nano with the file notes.txt. If the file does not exist yet, it will be created when you save it. To edit a system file that requires administrator privileges, prepend sudo.

sudo nano /etc/hosts

When nano opens, the screen is divided into two main areas. The top area displays the file contents, while the bottom two lines show the list of keyboard shortcuts and status messages. In that display, the symbol ^ means the Ctrl key and the symbol M- means the Alt key.

If you know exactly which line you want to go to, you do not need to open the file and scroll manually. Add the line number after a plus sign before the filename, or use a colon after the filename.

nano +45 notes.txt
nano notes.txt:45

Both commands above open notes.txt with the cursor directly on line 45. This is very helpful when you are following up on error messages that mention a specific line number, for example from journalctl output or a linter.

Navigation and Text Editing

You can move the cursor using the arrow keys on your keyboard. To move quickly, use the Page Up and Page Down keys to jump one screen, and Home and End to move to the beginning or end of a line.

Typing a character inserts it exactly at the cursor position. To delete a character, use Backspace for the character to the left of the cursor and Delete for the one to the right. To cut an entire line, press Ctrl+K, then paste it back with Ctrl+U. Ctrl+U can also be used repeatedly to duplicate the same line.

If you only want to copy a line without removing it from its original place, use Alt+6. That line is stored in the same cutbuffer and can be pasted with Ctrl+U as usual. To select more than one line before cutting or copying, press Alt+A to enable mark mode, move the cursor to extend the selection, then press Ctrl+K (cut) or Alt+6 (copy).

Saving and Exiting

To save your changes, press Ctrl+O. nano will ask for the filename to write. If you want to keep the same name, just press Enter. To exit nano, press Ctrl+X. If there are unsaved changes, nano will ask whether you want to save them first. Press Y to save, N to discard changes, or Ctrl+C to cancel and go back to editing.

When saving, you can also change the location or filename by editing the text shown before pressing Enter.

Besides Ctrl+O, there is also Ctrl+S for instant saving without filename confirmation — useful when you want to quickly save progress without leaving edit mode. Note that on some older terminals or certain SSH sessions, Ctrl+S might be intercepted by the terminal itself as a "stop output" (XOFF) signal, making the screen appear frozen; if this happens, press Ctrl+Q to resume.

Searching and Replacing Text

To search for a word or phrase inside the file, press Ctrl+F, then type the word you are looking for and press Enter. The cursor jumps to the first occurrence. To continue to the next occurrence in the forward direction, press Alt+F; to search backward, use Ctrl+B, and continue backward with Alt+B.

Note that the classic search shortcut Ctrl+W (and Alt+W for the next occurrence) used in older nano versions still works as an alternative; however, since version 8.0 the on‑screen help prioritises Ctrl+F/Ctrl+B as the primary shortcuts. So do not be confused if you find older tutorials mentioning Ctrl+W for searching — both are equally valid.

To replace text, press Alt+R (the classic shortcut Ctrl+\ also still works). You will be prompted to type the text to search for, followed by the replacement text. nano then offers several options for each match: Y to replace one match, A to replace all matches at once, N to skip that match, and Ctrl+C to cancel.

If before starting the replacement you have marked a region of text with Alt+A, then the search‑and‑replace process will only apply to that marked region — useful when you only want to change a specific part of the file without touching the rest.

Important nano Shortcuts

Below is a summary of the most frequently used nano shortcuts, aligned with the built‑in help display on the versions shipped with Ubuntu 26.04 LTS and Fedora Workstation 44. All ^ combinations are pressed together with the Ctrl key, and Alt+ combinations with the Alt key.

ShortcutFunction
Ctrl+OSave file (prompts for name before writing)
Ctrl+SQuick save without filename confirmation
Ctrl+XExit nano
Ctrl+FSearch forward (old shortcut: Ctrl+W)
Ctrl+BSearch backward
Alt+F / Alt+BContinue search forward / backward
Alt+RReplace text (old shortcut: Ctrl+\)
Ctrl+KCut line (or marked region)
Alt+6Copy line without cutting
Ctrl+UPaste cut/copied text
Alt+AMark start of text selection
Ctrl+AMove to beginning of line
Ctrl+EMove to end of line
Ctrl+CShow cursor position
Ctrl+GOpen nano help
Alt+UUndo
Alt+ERedo

If you come from a GUI editor background and feel more comfortable with shortcuts like Ctrl+C for copy or Ctrl+V for paste, nano provides the --modernbindings option (which can be run with nano -/) that remaps most shortcuts to a style more common in modern applications. This is optional and not required to learn at an early stage, but it is good to know it exists.

nano is a simple yet very useful tool. The ability to edit files directly from the terminal will be needed in almost every subsequent chapter, from changing system configurations to writing scripts. Once you have mastered the basic shortcuts above, you have opened the door to deeper Linux system management. After you feel comfortable with nano, you can explore more advanced editors such as vim in the next chapter.