The editing of files is a fundamental skill that every Linux user should master. Often you work in a terminal, and in this environment, it’s important to know how to efficiently edit text. In this guide, I will show you how to use the Nano editor to create and edit files without relying on graphical interfaces. Let’s explore the basic functions of the Nano editor together.
Key insights
- The Nano editor is a simple and user-friendly text editor for the command line.
- With Nano you can create, edit, save, and make text files searchable.
- The search and replace function allows for efficient editing of larger files.
Step-by-step guide
Starting Nano and opening a file
To get started with the Nano editor, open your terminal and navigate to the directory where the file you want to edit is located. To open or create a new file, enter the command: nano 50_Cars
Here, "50_Cars" is the name of the file you want to edit. Press Enter to start the editor. You will now see the Nano editor with a simple user interface.

Basic functions of the Nano editor
In the Nano editor you have various options you can use. At the bottom of the window, you will see a list of keyboard shortcuts for basic functions like saving and quitting. Note that you cannot work with the mouse here; all actions are controlled via the keyboard.
Entering and saving text
You can now enter text directly in the editor or edit values. For example: "This is my first Nano test". To save your changes, press Ctrl + O, after which you will be asked for a file name. Nano will suggest the already existing file name, which you can confirm by pressing Enter.

If you have added multiple lines, you will see a message indicating how many lines have been saved. If you are satisfied with the changes, you can exit the editor by pressing Ctrl + X.

Searching within the file
When working with larger files and wanting to search for a specific term, you can use the search function in the Nano editor. Press Ctrl + W, enter the word you want to search for, and press Enter again. Nano will take you to the first occurrence.
If you want to search for the word at another location, you can use Ctrl + B to show the next occurrence. This allows you to quickly navigate through the file and find what you're looking for.

Searching and replacing
One very helpful feature of Nano is the ability to search and replace. For example, if you want to replace the word "my" with "your", press Ctrl + W, then Ctrl + R. Now enter the word you want to replace, confirm with Enter, and then enter the new word.
After entering, Nano gives you the option to confirm each match one by one or to replace all occurrences at once. If you want to make multiple replacements, confirm them with "Y" for Yes or "A" for All.
Using help
If you ever feel stuck, the Nano editor offers an integrated help function. Press Ctrl + G to call up the help menu. Here you can scroll through various functions and commands to learn more about the capabilities of the editor.
In the help, you will find useful tips for working effectively with Nano. Even though it requires some getting used to, it is still a valuable skill that makes your work in the terminal easier.
Exiting the Nano editor
When you are finished with your changes and want to exit the editor, press Ctrl + X. Nano will ask you if you want to save the file. Confirm this with "Y" for Yes, and you will be prompted to enter the file name. If you do not want to change anything, you can choose "N" for No.

Now you have learned all the basic functions of the Nano editor and can immediately start editing your files.
Summary – Effectively edit files with the Nano editor in Linux
In this guide, you have learned how to effectively use the Nano editor to create, edit, and employ important functions like search and replace. You are now well-prepared to work productively in a terminal environment.
Frequently asked questions
What is the Nano editor?The Nano editor is a user-friendly text editor for the command line in Linux.
How do I save my changes in Nano?You can save your changes by pressing Ctrl + O and then Enter to confirm.
How do I search for a word in a file?Press Ctrl + W, enter the search word, and press Enter.
Can I also replace words with Nano?Yes, use Ctrl + W followed by Ctrl + R to search for and replace words.
How do I exit the Nano editor?Press Ctrl + X and confirm the save if you have made changes.