nano
Text processing
Usage
nano [file]A plain full-screen editor with its commands printed at the bottom; the caret in ^O and ^X means Ctrl, not a literal character.
Common flags
| Flag | Meaning |
|---|---|
| Ctrl-O | Write the file out; the caret in ^O means Ctrl |
| Ctrl-X | Leave nano, offering to save first |
| Ctrl-W | Search; Alt-W repeats the search |
| -w | Do not wrap long lines, which config files need |
| -B | Keep a backup of the file as it was |
| +N | Open with the cursor on line N |
| --linenumbers | Show line numbers (nano 4.0 and later) |
Examples
sudo nano /etc/hostsCtrl-O to write, Ctrl-X to leave.
nano -w /etc/nginx/nginx.confNo line wrapping, so directives stay on one line.
nano +25 deploy.shOpens at line 25.
These were built to be piped together. Three joined commands are usually shorter than one that does everything.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does nano do?
A plain full-screen editor with its commands printed at the bottom; the caret in ^O and ^X means Ctrl, not a literal character.
Q. How do I type it?
nano [file] — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
7 are listed here; the full set is in man nano. This command sits under Text processing.
Related commands
man page: man nano