nano(1)
nano is a simple, user-friendly terminal text editor for creating and editing files.
Synopsis
nano [OPTION]... [FILE]...Description
nano is a small, free, and friendly text editor that runs in the terminal. It is easier to use than vi or vim for beginners because it displays keyboard shortcuts at the bottom of the screen. You can open existing files for editing or create new ones.
nano works with plain text files and is commonly used for quick edits of configuration files, scripts, and documents. Changes are held in a buffer until you explicitly save them.
Common options
| Flag | What it does |
|---|---|
-w | disable word wrapping; long lines extend off-screen |
-l | enable line numbers on the left margin |
-m | enable mouse support to click and scroll in the editor |
-c | show cursor position (line and column) in status bar |
-u | disable undo/redo functionality |
-v | open file in view mode (read-only, no editing) |
-B | create backup files with .bak extension before saving |
-i | indent new lines to match the previous line's indentation |
Examples
open or create myfile.txt for editing
nano myfile.txtedit the hosts file with line numbers displayed
nano -l /etc/hostsedit a shell script without automatic word wrapping
nano -w script.shview config.conf in read-only mode without editing ability
nano -v config.confedit notes.txt with mouse support and cursor position indicator
nano -m -c notes.txtopen nano with an empty buffer; use Ctrl+O to save when done
nano