Editing with nano
A simple terminal editor.
Echo is fine for one line. But to really edit a file, moving around, fixing typos, adding paragraphs, you need a text editor. The friendliest one in the terminal is called nano.

- Echo is fine for one line
- Real editing needs an editor
- nano is the friendliest
Opening nano
Type nano, followed by a file name. If the file exists, nano opens it. If not, nano starts a new, empty file with that name. The file fills the window, and you can type straight away, just like in any editor. At the bottom, nano lists its shortcuts.
Editing a shopping list
Here's notes dot TXT open in nano. We move down with the arrow keys, and fix the second line. Then we add a new item at the end. The caret symbol at the bottom means the control key.
Buy milk
Call Mum and Dad
Learn Linux
Book dentist
^O Write Out ^X Exit ^W Where Is ^K Cut ^U PasteThe keys you need
You only need a few keys to use nano well. Control O writes out, which means save. Nano asks for the file name, and you press Enter. Control X exits. If there are unsaved changes, it asks if you want to save them. Control W searches. And control K cuts a line, while control U pastes it.
| Keys | Does |
|---|---|
| Ctrl + O, Enter | save |
| Ctrl + X | exit |
| Ctrl + W | search |
| Ctrl + K / Ctrl + U | cut / paste a line |
Summary
Nano edits files in the terminal. Control O saves, control X exits. Next, finding out what kind of file something is.
Key takeaways- nano <file>
- Ctrl+O saves
- Ctrl+X exits